iOS Build Error - plist Insertion

50 views
Skip to first unread message

mcw

unread,
Nov 4, 2016, 6:27:03 PM11/4/16
to CodenameOne Discussions
I am trying to insert code into my plist for the Apple ATS changes.

If I use the example you gave to disable it:

ios.plistInject=<key>NSAppTransportSecurity</key><dict><key>NSAllowsArbitraryLoads</key><true/></dict>

Everything works fine and I can make the connection. But obviously I don't want to do this. I am trying to make a local connection from an iOS device to my PC over my home network. Apple recognize this condition, I think,
NSAllowsLocalNetworking. From the Apple article you reference:

An optional Boolean value that, when set to YES, removes App Transport Security protections for connections to unqualified domains and to .local domains, without disabling ATS for the rest of your app.

If you set this key’s value to YES, then App Transport Security ignores the value of the NSAllowsArbitraryLoads key in iOS 10 and later and in macOS 10.12 and later. This behavior supports adoption of App Transport Security protections while allowing embedded browsers to continue working in iOS 9 and earlier and in OS X v10.11 and earlier. (To obtain this behavior, set the value of this key to YES and set the value of the NSAllowsArbitraryLoads key to YES as well.)

Default value is NO.

Available starting in iOS 10.0 and macOS 10.12.


If I read this correctly I have to set both

NSAllowsArbitraryLoads and NSAllowsLocalNetworking to true. And therein lies my problem, whatever I do results in a build failure on the plist step. I have no idea how to format the plist entry.

I have tried things like:

<key>NSAppTransportSecurity</key><dict><key>NSAllowsLocalNetworking</key><true/></key><key>NSAllowsArbitraryLoads</key><true/></dict>

<key>NSAppTransportSecurity</key><dict><key>NSAllowsArbitraryLoads</key><true/></dict><dict><key>NSAllowsLocalNetworking</key><true/></dict>

but the build always fails. I obviously have no idea what I am doing here. How do I format the plist entry?


Thanks


Shai Almog

unread,
Nov 5, 2016, 1:16:50 AM11/5/16
to CodenameOne Discussions
I think this should work:

ios.plistInject=<key>NSAppTransportSecurity</key><dict><key>NSAllowsArbitraryLoads</key><true/><key>NSAllowsLocalNetworking</key><true/></dict>


mcw

unread,
Nov 8, 2016, 5:45:16 PM11/8/16
to CodenameOne Discussions
Thanks, that fixes the problem.

The build works and I am able to connect. According to the docs this does not require an app store review, so hopefully it will be a smooth upgrade.
Reply all
Reply to author
Forward
0 new messages