ios - info.plist key name from xcconfig file -


i trying adopt ios9 ats support in app. following code work sure

<key>nsapptransportsecurity</key> <dict>     <key>nsexceptiondomains</key>     <dict>         <key>yourhost.com</key>         <dict>             <key>nsincludessubdomains</key>             <true/>             <key>nstemporaryexceptionallowsinsecurehttploads</key>             <true/>             <key>nstemporaryexceptionminimumtlsversion</key>             <string>1.0</string>             <key>nstemporaryexceptionrequiresforwardsecrecy</key>             <false/>         </dict>    </dict> </dict> 

but problem here have defined server url in xcconfig file different development , distribution environment.

so, problem here want server urls xcconfig file serve key names in place of 'yourhost.com' in above code.

so when try fetch server url as

${server_url} , following error as

app transport security has blocked cleartext http (http://) resource load since insecure. temporary exceptions can configured via app's info.plist file.

this means key name not taken , on other hand if directly set key value here, works perfectly.

my xcconfig file contains following code:

server_url=myserverurl.com 

i unable set key name have directly take xcconfig file.

how can that?

you can enable preprocessing plist files.

this helped me handle it: http://ilya.puchka.me/info-plist-preprocessing/

1) enable build settings -> "preprocess info.plist file"

2) add preprocessor definitions @ "info.plist preprocessor definition" (of cause can define xcconfig)

infoplist_preprocessor_definitions = $(inherited) config_domain=$(server_url) 

3) if use urls in plist add "-traditional" in "info.plist other preprocessor flags" (see https://developer.apple.com/library/mac/technotes/tn2175/_index.html#//apple_ref/doc/uid/dts10004415-ch1-tntag3)

for other issues @ preprocessing info.plist can here xcode "cannot parse contents of info.plist"

now can use preprocessed definition key in plist

<key>config_domain</key> 

Comments

Popular posts from this blog

html - Outlook 2010 Anchor (url/address/link) -

javascript - Why does running this loop 9 times take 100x longer than running it 8 times? -

Getting gateway time-out Rails app with Nginx + Puma running on Digital Ocean -