iOS Question webview will not load a url stored in a variable.

ottercat

Member
Licensed User
In android I have no problem. In ios if I have a link stored in say aLink and put webview.loadurl(aLink) it does nothing and a log statement after it does not fire. If I put in "a website" instead, it loads fine.
 

roumei

Active Member
Licensed User
I don't think that there is a difference between a variable and directly putting the URL in quotes (but there are some problems with LoadURL in iOS < 14).
I tested it on iOS 14.6 and I get the same behavior for both variants.
Could you try it with https? Most webpages need some kind of consent and http doesn't work very well for that.
 
Last edited:
Upvote 1

MarcoRome

Expert
Licensed User
Longtime User
If you put a link like http://www.yahoo.com in a variable and then try to load the variable it won't work.
If you put the link in quotes, not in a variable it loads.

Why do you use yahoo with out "https" ?
Anyway when you use http is important add:

#ATSEnabled: True
'If you want to show non-secure pages in WebView and allow the user to navigate to other domains as well:
#PlistExtra: <key>NSAppTransportSecurity</key><dict><key>NSAllowsArbitraryLoads</key><true/>
#PlistExtra: <key>NSAllowsArbitraryLoadsInWebContent</key><true/>
#PlistExtra: </dict>

Look:
 
Last edited:
Upvote 0
Top