Angularjs http.jsonp iOS9 404 [英] Angularjs http.jsonp iOS9 404

查看:199
本文介绍了Angularjs http.jsonp iOS9 404的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个从我的服务器得到一些JSON一个科尔多瓦Angularjs应用程序。它适用于iOS 8,但是当我升级到iOS 9现在我正在从我的服务器什么。该服务器尚未改变,我可以看到JSON响应,如果我浏览到我的网址。

I have a Cordova Angularjs app that is getting some JSON from my server. It works on iOS 8, but when I "upgraded" to iOS 9 I am now getting nothing from my server. The server has not been changed, and I can see the JSON response if I navigate to my url.

我narowed下来一点点我的$ http.jsonp()方法。试图获取JSON时,它给我一个404错误。完全相同的code正常工作,并获取JSON在iOS 8设备上。

I narowed it down a little to my $http.jsonp() method. It is giving me a 404 error when trying to retrieve the JSON. The same exact code works fine and gets the JSON on an iOS 8 device.

其他任何人有这个和iOS 9个问题,并想出更多了呢?它肯定似乎是一个苹果相关的问题...

Anyone else having an issue with this and iOS 9 and have figured any more out? It definitely seems like an Apple related issue...

推荐答案

添加到您的的info.plist 文件。

<key>NSAppTransportSecurity</key> 
<dict> 
    <key>NSAllowsArbitraryLoads</key><true/>
</dict>

从<一个href=\"https://developer.apple.com/library/$p$prelease/ios/releasenotes/General/WhatsNewIniOS/Articles/iOS9.html\">this 页

应用程序传输安全(ATS)强制在应用程序和后端之间的安全连接的最佳做法。 ATS prevents意外泄露,提供安全的默认行为,并且容易被采纳;这也是对iOS版中默认的9和OS X v10.11。您应该尽快采取ATS,不管你是创建一个新的应用程序或更新现有的。

App Transport Security (ATS) enforces best practices in the secure connections between an app and its back end. ATS prevents accidental disclosure, provides secure default behavior, and is easy to adopt; it is also on by default in iOS 9 and OS X v10.11. You should adopt ATS as soon as possible, regardless of whether you’re creating a new app or updating an existing one.

如果你正在开发一个新的应用程序,你应该只使用HTTPS。如果你有一个现有的应用程序,您应该使用HTTPS尽可能可以,现在,为尽快迁移您的应用程序的其余部分创建一个计划。此外,通过高级API的通信需要使用TLS 1.2版具有前向安全加密。如果试图使不遵循这一要求的连接,则会引发错误。如果您的应用需要提出请求到不安全的域,您必须指定在您的应用程序的Info.plist文件这一领域。

If you’re developing a new app, you should use HTTPS exclusively. If you have an existing app, you should use HTTPS as much as you can right now, and create a plan for migrating the rest of your app as soon as possible. In addition, your communication through higher-level APIs needs to be encrypted using TLS version 1.2 with forward secrecy. If you try to make a connection that doesn't follow this requirement, an error is thrown. If your app needs to make a request to an insecure domain, you have to specify this domain in your app's Info.plist file.

本已iOS9被默认开启。他们建议使用https尽可能发展。要解决这个问题,你将需要previous code在这个答案。

This has been turned on by default in iOS9. They suggest developing using https whenever possible. To get around that you would need the previous code in this answer.

这篇关于Angularjs http.jsonp iOS9 404的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆