Guys i try to learn webview it can\'t load give me error like:
NSURLConnection finished with error - code -1022
- (voi
Few silly things but give a try as below:
First, you can try to check the issue on the simulator i.e run the app in the simulator and check whether still there is an issue.
In-network class or where your API call function check whether this is implemented
request.allHTTPHeaderFields = ["Content-Type" : "application/json"]
Right-click on info.plist file. select open as source code.
check and find below whether lines are present
<key>NSAppTransportSecurity</key>
<dict>
<key>NSAllowsArbitraryLoads</key>
<true/>
</dict>
if not present add above lines just before /dict:
Also, check if you are URL is from the local server and you are switching to the different live URL.
Check the internet connection of the device.
To give an answer on your question we need to see full logs. But I guess the problem in the App Transport Security. Since iOS 9 all connection should be done with https and the destination url should be backed with TLS version greater or equal 1.2, until you'll not specify exceptions in info.plist file in App Transport security section. Also you can "Allow Arbitrary Loads" for all connections, but this way isn't preferred. You can read more details about this here https://developer.apple.com/library/content/documentation/General/Reference/InfoPlistKeyReference/Articles/CocoaKeys.html (in the NSAppTransportSecurity section)
I think it is about App Transport Security.Because your url is not https.Try to change like this in the info.plist file
<key>NSAppTransportSecurity</key>
<dict>
<key>NSAllowsArbitraryLoads</key>
<true/>
</dict>
You are getting this error because you are not using https url. To fix follow below steps:
Add below line just before /dict:
<key>NSAppTransportSecurity</key>
<dict>
<key>NSAllowsArbitraryLoads</key>
<true/>
</dict>
I was having a similar issue,
NSURLConnection finished with error - code -1200
I was trying to reach a blocked port in my company. Changing the port let me connect normally.
As pointed out below, disabling Firewall could also solve the issue.