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"
如果我尝试在浏览器中访问它们,它们工作正常.
我习惯使用NSURLSession.sharedSession().dataTaskWithRequest()来访问数据库和PHP文件,现在它会引发标题中的错误.例如,这是引发错误的行:
if let responseJsON: [[String: String]] = (try? NSJsONSerialization.JsONObjectWithData(data!,options: NSJsONReadingOptions())) as? [[String: String]] {...}
这是完整的错误消息:
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 an Optional value
我想知道如何解决这个问题.我在这里已经阅读了一些有用的答案,但有许多事情我仍然不明白,如果有人愿意帮助/解释我,我将非常感激.
解决方法 将其添加到您应用的Info.pList中<key>NSAppTransportSecurity</key> <dict> <key>NSAllowsArbitraryLoads</key> <true/> </dict>总结
以上是内存溢出为你收集整理的ios – Swift / https:NSURLSession / NSURLConnection HTTP加载失败全部内容,希望文章能够帮你解决ios – Swift / https:NSURLSession / NSURLConnection HTTP加载失败所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)