diff --git a/Configurations/set-ats-exceptions.sh b/Configurations/set-ats-exceptions.sh new file mode 100755 index 00000000..9b5fa1b9 --- /dev/null +++ b/Configurations/set-ats-exceptions.sh @@ -0,0 +1,12 @@ +#!/bin/sh + +# http://stackoverflow.com/questions/32390228/is-it-possible-to-disable-ats-in-ios-9-just-for-debug-environment +INFOPLIST="${TARGET_BUILD_DIR}"/"${INFOPLIST_PATH}" +case "${SPARKLE_ALLOW_ARBITRARY_HTTP_LOADS}" in +"YES"|"1") +/usr/libexec/PlistBuddy -c "Set :NSAppTransportSecurity:NSAllowsArbitraryLoads YES" "${INFOPLIST}" +;; +"NO"|"0") +/usr/libexec/PlistBuddy -c "Set :NSAppTransportSecurity:NSAllowsArbitraryLoads NO" "${INFOPLIST}" +;; +esac diff --git a/Sparkle.xcodeproj/project.pbxproj b/Sparkle.xcodeproj/project.pbxproj index 60fbf6de..0cf6d839 100644 --- a/Sparkle.xcodeproj/project.pbxproj +++ b/Sparkle.xcodeproj/project.pbxproj @@ -898,6 +898,7 @@ 72E45DDC1B65C3BD005C701A /* sign_update */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.sh; name = sign_update; path = bin/sign_update; sourceTree = SOURCE_ROOT; }; 72EB87E91CB8798800C37F42 /* ShowInstallerProgress.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = ShowInstallerProgress.m; path = Sparkle/InstallerProgress/ShowInstallerProgress.m; sourceTree = SOURCE_ROOT; }; 72F94EB01CC2A865002DEE68 /* ConfigCommonReleaseHTTP.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = ConfigCommonReleaseHTTP.xcconfig; sourceTree = ""; }; + 72F94ED31CC33F1E002DEE68 /* set-ats-exceptions.sh */ = {isa = PBXFileReference; lastKnownFileType = text.script.sh; path = "set-ats-exceptions.sh"; sourceTree = ""; }; 767B61AA1972D488004E0C3C /* SUGuidedPackageInstaller.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SUGuidedPackageInstaller.h; sourceTree = ""; }; 767B61AB1972D488004E0C3C /* SUGuidedPackageInstaller.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SUGuidedPackageInstaller.m; sourceTree = ""; }; 8DC2EF5A0486A6940098B216 /* Sparkle-Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = "Sparkle-Info.plist"; sourceTree = ""; }; @@ -1626,6 +1627,7 @@ 72D954B01CBB41E2006F28BD /* ConfigSparkleTool.xcconfig */, 14732BC91960F70A00593899 /* make-release-package.sh */, 14652F7919A93E5F00959E44 /* set-git-version-info.sh */, + 72F94ED31CC33F1E002DEE68 /* set-ats-exceptions.sh */, 146EC84E19A68CF8004A50C5 /* Sparkle.podspec */, ); path = Configurations; @@ -1911,7 +1913,7 @@ 728638EF1CAF5A5F00783084 /* Sources */, 728638F01CAF5A5F00783084 /* Frameworks */, 728638F11CAF5A5F00783084 /* Resources */, - 728639051CAF64EF00783084 /* ShellScript */, + 72F94ED41CC33F35002DEE68 /* ShellScript */, ); buildRules = ( ); @@ -2310,19 +2312,6 @@ shellScript = "ln -sfh \"pt_BR.lproj\" \"$BUILT_PRODUCTS_DIR/$UNLOCALIZED_RESOURCES_FOLDER_PATH/pt.lproj\""; showEnvVarsInLog = 0; }; - 728639051CAF64EF00783084 /* ShellScript */ = { - isa = PBXShellScriptBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - inputPaths = ( - ); - outputPaths = ( - ); - runOnlyForDeploymentPostprocessing = 0; - shellPath = /bin/sh; - shellScript = "# http://stackoverflow.com/questions/32390228/is-it-possible-to-disable-ats-in-ios-9-just-for-debug-environment\n\nINFOPLIST=\"${TARGET_BUILD_DIR}\"/\"${INFOPLIST_PATH}\"\ncase \"${SPARKLE_ALLOW_ARBITRARY_HTTP_LOADS}\" in\n\"YES\"|\"1\")\n/usr/libexec/PlistBuddy -c \"Set :NSAppTransportSecurity:NSAllowsArbitraryLoads YES\" \"${INFOPLIST}\"\n;;\n\"NO\"|\"0\")\n/usr/libexec/PlistBuddy -c \"Set :NSAppTransportSecurity:NSAllowsArbitraryLoads NO\" \"${INFOPLIST}\"\n;;\nesac"; - }; 728639061CAF651300783084 /* ShellScript */ = { isa = PBXShellScriptBuildPhase; buildActionMask = 2147483647; @@ -2334,7 +2323,20 @@ ); runOnlyForDeploymentPostprocessing = 0; shellPath = /bin/sh; - shellScript = "# http://stackoverflow.com/questions/32390228/is-it-possible-to-disable-ats-in-ios-9-just-for-debug-environment\n\nINFOPLIST=\"${TARGET_BUILD_DIR}\"/\"${INFOPLIST_PATH}\"\ncase \"${SPARKLE_ALLOW_ARBITRARY_HTTP_LOADS}\" in\n\"YES\"|\"1\")\n/usr/libexec/PlistBuddy -c \"Set :NSAppTransportSecurity:NSAllowsArbitraryLoads YES\" \"${INFOPLIST}\"\n;;\n\"NO\"|\"0\")\n/usr/libexec/PlistBuddy -c \"Set :NSAppTransportSecurity:NSAllowsArbitraryLoads NO\" \"${INFOPLIST}\"\n;;\nesac"; + shellScript = "${SRCROOT}/Configurations/set-ats-exceptions.sh"; + }; + 72F94ED41CC33F35002DEE68 /* ShellScript */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputPaths = ( + ); + outputPaths = ( + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "${SRCROOT}/Configurations/set-ats-exceptions.sh"; }; /* End PBXShellScriptBuildPhase section */