ios - Swift/https: NSURLSession/NSURLConnection HTTP load failed -
unfortunately morning xcode updated version 7 , ios app developing http wants https. so, following many tutorials, configured mamp server in order use https/ssl creating dummy certificate. in ios app urls following:
static var webserverloginurl = "https://localhost:443/excogitoweb/mobile/loginm.php" static var webservergetusertasks = "https://localhost:443/excogitoweb/mobile/handletasks.php" static var webservergetusers = "https://localhost:443/excogitoweb/mobile/handleusers.php" static var webservergetprojects = "https://localhost:443/excogitoweb/mobile/handleprojects.php"
and work fine if try access them in browser. used access database , php files nsurlsession.sharedsession().datataskwithrequest() raises error in title. example, here's line error raised:
if let responsejson: [[string: string]] = (try? nsjsonserialization.jsonobjectwithdata(data!, options: nsjsonreadingoptions())) as? [[string: string]] { ... }
and complete error message:
2015-09-21 16:41:48.354 excogitoweb[75200:476213] cfnetwork sslhandshake failed (-9824) 2015-09-21 16:41:48.355 excogitoweb[75200:476213] nsurlsession/nsurlconnection http load failed (kcfstreamerrordomainssl, -9824) fatal error: unexpectedly found nil while unwrapping optional value
i know how fix this. i've read useful answers here there many things still don't understand , if help/explain me i'd grateful.
add app's info.plist
<key>nsapptransportsecurity</key> <dict> <key>nsallowsarbitraryloads</key> <true/> </dict>
Comments
Post a Comment