xcode - iOS Simulator not connecting to web service -
i developing cordova project on xcode.
am using cordova v5.4.1, xcode v7.2 , ios simulator v9.2.
the app building , deploying on emulator rest web services not being consumed. able view json response web service in emulator's safari browser, app not show same.
i have enabled "allow http services" in developer settings , tried restarting emulator , xcode, nothing helps. have added these lines config.xml.
<plugin name="cordova-plugin-whitelist" spec="1" /> <access origin="*" />
how can issue fixed?
maybe you're getting blocked ios 9 ats (app transport security)?
to test if case, try on mac, using terminal.app:
nscurl --ats-diagnostics https://api.your-server.com
if ats allow connecting https://api.your-server.com, should see this, in first block of response:
default ats secure connection --- ats default connection result : pass ---
anything else means ats block http(s) requests going through.
to resolve this, can either fix issue @ root (use https tls 1.2, sha256 or better, , forward secrecy), recommended solution, not possible, or define exception server allowed in app-info.plist
file. example:
<key>nsapptransportsecurity</key> <dict> <key>nsexceptiondomains</key> <dict> <key>api.your-server.com</key> <dict> <key>nsexceptionminimumtlsversion</key> <string>tlsv1.1</string> <key>nsexceptionrequiresforwardsecrecy</key> <false/> </dict> </dict> </dict>
more info on ats, , values can use define exceptions: https://developer.apple.com/library/prerelease/ios/documentation/general/reference/infoplistkeyreference/articles/cocoakeys.html
if else fails, can try use cordova plugin: https://github.com/robertklein/cordova-ios-security don't recommend it, disables ats, pretty-bad-idea™.
Comments
Post a Comment