How to load HTTP content in Webkit in objective-c?
The code I use:
NSString *loadedURL = @"http://www.apple.com";
NSURL *targetURL = [NSURL URLWithString:loadedURL];
NSURLRequest *request = [NSURLRequest requestWithURL:targetURL];
[_webView loadRequest:request];
If i post a link "https://www.apple.com" (with httpS) its open correctly, but from HTTP not. Can you help me?
CodePudding user response:
Please check whether the App Transport Security restrictions are disabled for all network connections, which means that unsecured http connections may be allowed.
Steps:
Opened my Projects info.plist file
Added a Key called NSAppTransportSecurity as a Dictionary.
Added a Subkey called NSAllowsArbitraryLoads as Boolean and set its value to YES as like following image.
Now clean the Project and Now Everything will Run fine as like before.