Swift Hipster
Swift Hipster

Reputation: 1664

Xcode build configuration based app transport layer security

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?

Upvotes: 2

Views: 478

Answers (3)

Swift Hipster
Swift Hipster

Reputation: 1664

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

Upvotes: 3

Wain
Wain

Reputation: 119031

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.

Upvotes: 2

Ashish
Ashish

Reputation: 2018

Create a different plist file for the debug version and use it. This would serve your purpose I am sure.enter image description here

Upvotes: 3

Related Questions