Hi I am new to iOS development.
I have a PHP file on another machine that creates JSON, and wanted to grab it from iOS application.
I tried to use the IP address to connect from the iOS application with NSURL
NSURL *url = [NSURL URLWithString:@"http://192.168.xx.xxx/JSON/JSONtoIOS.php"];Then, I added below code in info.plist file:
<key>NSAppTransportSecurity</key>
<dict>
<key>NSAllowsArbitraryLoads</key>
<true/>
</dict>
However, I am still getting a same error message: "Transport security has blocked a cleartext HTTP (http://) resource load since it is insecure. Temporary exceptions can be configured via your app's Info.plist file."
The URL opens fine on a web browser, but having a problem with NSData returing nil.
Can anyone help me on this issue?
Thank you.
However, I am still getting a same error message: "Transport security has blocked a cleartext HTTP (http://) resource load since it is insecure. Temporary exceptions can be configured via your app's Info.plist file."
Setting
NSAllowsArbitraryLoads should prevent App Transport Security (ATS) from blocking HTTP requests. I recommend that you double check that your built binary contains the settings that you think it contains.
Share and Enjoy
—
Quinn "The Eskimo!"
Apple Developer Relations, Developer Technical Support, Core OS/Hardware
let myEmail = "eskimo" + "1" + "@apple.com"