iOS Question unsecured calls to specific domains and non-secure pages in WebView at the same time

Pablo Torres

Active Member
Licensed User
Longtime User
Hi Everyone, I know how to make unsecured calls to specific domains using
B4X:
#PlistExtra: <key>NSAppTransportSecurity</key><dict><key>NSAllowsArbitraryLoads</key><false/>
#PlistExtra: <key>NSExceptionDomains</key><dict>
'list the excluded domains (example.com and b4x.com)
#PlistExtra: <key>soft.uy</key><dict><key>NSIncludesSubdomains</key><true/><key>NSExceptionAllowsInsecureHTTPLoads</key><true/></dict>
'end of excluded domains
#PlistExtra: </dict>
#PlistExtra: </dict>
and i also know how to load non-secure pages in webview using
B4X:
#PlistExtra: <key>NSAppTransportSecurity</key><dict><key>NSAllowsArbitraryLoads</key><true/>
#PlistExtra: <key>NSAllowsArbitraryLoadsInWebContent</key><true/>
#PlistExtra: </dict>

But I can´t do both features at the same time, can anyone help me? please
 

Semen Matusovskiy

Well-Known Member
Licensed User
https requires nothing. If you need http, use top variant and to describe all domains, where you use http.
B4X:
    #PlistExtra         : <key>NSAppTransportSecurity</key><dict><key>NSAllowsArbitraryLoads</key><false/><key>NSExceptionDomains</key><dict>
                        ' Add domains with http
    #PlistExtra         : <key>domain1.com</key><dict><key>NSIncludesSubdomains</key><true/><key>NSExceptionAllowsInsecureHTTPLoads</key><true/></dict>
    #PlistExtra         : <key>domain2.com</key><dict><key>NSIncludesSubdomains</key><true/><key>NSExceptionAllowsInsecureHTTPLoads</key><true/></dict>
                        ' End of list
    #PlistExtra         : </dict></dict>

Can you post an example of troubles ? I listened about some problems, when a webpage mixes https and http (due to images, scripts and etc)
 
Last edited:
Upvote 0

Pablo Torres

Active Member
Licensed User
Longtime User
I guess you did not understand my question.
if i use this
B4X:
#PlistExtra: <key>NSAppTransportSecurity</key><dict><key>NSAllowsArbitraryLoads</key><true/>
#PlistExtra: <key>NSAllowsArbitraryLoadsInWebContent</key><true/>
#PlistExtra: </dict>
Then I can Load http in webview, but I can't conect to http domain or subdomains to ask for data.
If I don't use the code above, I cant load http in webview (only https)
So... my question is, how can I load http in webview and connect to http domains at the same time? Is that posible? How?
 
Upvote 0

Semen Matusovskiy

Well-Known Member
Licensed User
Coming back to post #1. Guess combined variant looks so
B4X:
#PlistExtra: <key>NSAppTransportSecurity</key><dict><key>NSAllowsArbitraryLoads</key><false/>
#PlistExtra: <key>NSAllowsArbitraryLoadsInWebContent</key><true/>
#PlistExtra: <key>NSExceptionDomains</key><dict>
'list the excluded domains (example.com and b4x.com)
#PlistExtra: <key>soft.uy</key><dict><key>NSIncludesSubdomains</key><true/><key>NSExceptionAllowsInsecureHTTPLoads</key><true/></dict>
'end of excluded domains
#PlistExtra: </dict>
#PlistExtra: </dict>

In your first variant NSAllowsArbitraryLoads is false, in second - true.
Guess, false is Ok, because documentation says :
In iOS 10 and later and macOS 10.12 and later, the value of the NSAllowsArbitraryLoads key is ignored—and the default value of NO used instead—if any of the following keys are present in your app’s Information Property List file:
 
Upvote 0
Top