I have 2 build configurations as usual. Debug
,Adhoc
,Release
. I want to disable iOS App transport layer security for Debug
configuration. So basically I want to have changes in Info.plist that are different for each configuration. How Could I achieve this?
Asked
Active
Viewed 405 times
2

Swift Hipster
- 1,604
- 3
- 16
- 24
3 Answers
3
Create a different plist file for the debug version and use it. This would serve your purpose I am sure.

Ashish
- 1,978
- 1
- 15
- 7
-
1This works. I wish we cud have more elegant solution. I tried to set user defined setting. And Use that to set Allow Arbitrary Load option. But it doesn't work. – Swift Hipster Feb 29 '16 at 09:56
3
This is what I came up with to achieve this.
Added a run script with following.
if [ "${CONFIGURATION}" = "Debug" ]; then
/usr/libexec/PlistBuddy -c "Set :NSAppTransportSecurity:NSAllowsArbitraryLoads YES" ProjectName/Info.plist
fi

Swift Hipster
- 1,604
- 3
- 16
- 24
2
You can use a build script to inject details into the plist. This would use a setup like this answer to determine the build type and would use PlistBuddy
to edit the plist. This is a very flexible but relatively complex solution, it allows you very fine grained control.
The other answer about using multiple different plist files is a lot simpler but requires that you maintain multiple copies of the plist and ensure that they are updated appropriately.
-
Both answers are valid. I will accept this as I ended up using this approach. This also explains the differences between two. I will add some code I used below. – Swift Hipster Mar 01 '16 at 04:53