NSAllowsArbitraryLoadsInWebContent in CN1

前端 未结 1 1026
攒了一身酷
攒了一身酷 2021-01-07 03:27

I\'m trying to deal with Apple\'s http restrictions on Codename One.

According to iOS Cocoa keys doc, NSAllowsArbitraryLoadsInWebContent will work on iOS 10 followin

相关标签:
1条回答
  • 2021-01-07 04:00

    I don't understand what steps you were trying to take, but if you are trying to allow http URLs in your application, Codename one made it simple by allowing you to add this build hint

    ios.plistInject=<key>NSAppTransportSecurity</key><dict><key>NSAllowsArbitraryLoads</key><true/></dict><key>CFBundleURLTypes</key><array><dict><key>CFBundleURLName</key><string>com.mycompany.myapp</string></dict><dict><key>CFBundleURLSchemes</key><array><string>MyApp</string></array></dict></array> 
    

    Change com.mycompany.myapp and MyApp accordingly.

    Just add that build hint and your http / https URLs will work seamlessly on all iOS versions including iOS 9 and 10.

    I currently use this on some of my apps and it works fine, tested on 10.1 beta 3 as well.

    EDIT:

    After reading your question again, I realized that your questions were not answered:

    Yes, the key will work even if BrowserComponent doesn't expose UIWebView. (Based on personal test)

    Just use NSAllowsArbitraryLoads and set it to true as discussed above, and it will handle everything. NSAllowsArbitraryLoads will only be ignored in iOS 10 if you set NSAllowsArbitraryLoadsInWebContent.

    0 讨论(0)
提交回复
热议问题