简体   繁体   English

Ajax请求在带有Cordova项目的IBM Mobilefirst中无法在iOS 9上运行

[英]Ajax request not working on iOS 9 in IBM Mobilefirst with cordova project

After upgrade to i0S 9 (and upgrade Mobile first project to 7.1, all request to my server failed. I read about the changes related to iOS 9, but can't find any support for resolve this problem in hybrid applications (Javascript based). 升级到i0S 9(并将Mobile first项目升级到7.1)后,对服务器的所有请求均失败。我了解了与iOS 9相关的更改,但是在混合应用程序(基于Javascript)中找不到解决此问题的任何支持。

IBM Mobile First, or cordova support that problem? 是IBM Mobile First,还是cordova支持那个问题?

Everything is fine on Android. 在Android上一切正常。

In iOS 9 Apple has introduced what is called Application Transport Security (ATS). 苹果在iOS 9中引入了所谓的应用程序传输安全性(ATS)。
Yes, this is not related to Android. 是的,这与Android无关。 It is iOS-only. 它仅适用于iOS。

Read more about ATS in this blog post , which also contains workarounds for ATS: either setting a whitelist to allow unsecure requests to pass, or disable it completely ( for development-time only ). 在此博客文章中了解有关ATS的更多信息 ,其中还包含ATS的变通方法:设置白名单以允许不安全的请求通过,或者完全禁用它( 仅用于开发时 )。

Note that Hybrid applications already disable it built-in (as mentioned, for development-time. It must be properly configured for production), by adding the following in the application's .plist file. 请注意,通过在应用程序的.plist文件中添加以下内容,Hybrid应用程序已经禁用了它的内置功能(如前所述,用于开发时。必须对其进行正确配置以用于生产)。 For Native apps you must do this yourself: 对于本机应用程序,您必须自己执行以下操作:

<key>NSAppTransportSecurity</key>
    <dict>
      <key>NSExceptionDomains</key>
      <dict>
        <key>mbp-idan</key>
        <dict>
          <key>NSIncludesSubdomains</key>
          <true/>
          <key>NSTemporaryExceptionAllowsInsecureHTTPLoads</key>
          <true/>
        </dict>
      </dict>
    </dict>

I am using the latest available version which can be downloaded either from IBM Fix Central, or by checking for updates in Eclipse: IBM MobileFirst Platform Studio 7.1.0.00-20150929-1541. 我正在使用可以从IBM Fix Central下载或通过在Eclipse中检查更新来下载的最新可用版本:IBM MobileFirst Platform Studio 7.1.0.00-20150929-1541。

If you are using an older release, you must upgrade. 如果使用的是较旧的版本,则必须升级。

我遇到了同样的问题,只需安装传输安全插件cordova-plugin-transport-security

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM