【问题标题】:Cordova app can't connect with Dynamics NAV Web-Service (ODATA) after update to iOS 10更新到 iOS 10 后,Cordova 应用程序无法与 Dynamics NAV Web-Service (ODATA) 连接
【发布时间】:2016-10-20 07:59:18
【问题描述】:

我们正在使用 Cordova 开发一个应用程序,该应用程序将信息与 Microsoft Dynamics NAV 2013 中间层提供的 ODATA Web 服务同步。 在 Android 下连接没有问题,在 iOS 8 和 9 下也可以正常工作。在使用 iOS 10 的设备上,连接不起作用并返回 HTTP 400 Bad Request 错误。 连接具有以下结构(这是测试代码,适用于 Android 和 iOS 8 和 9,但不适用于 iOS 10)

var xreq = new XMLHttpRequest();
xreq.open('GET', "http://domain:port/MIDDLETIER/OData/MobileSetupMWP?$format=json",true,username,password);
xreq.onreadystatechange = function () {
  if (xreq.readyState == 4) {
      if (xreq.status == 200) {
        alert("success");
      } else {
        alert("failure");
      }
  }
}
try {
  xreq.send();
} catch (e) {
  }

Web 服务使用 Digest 作为身份验证,可用作 http 和 https Web 服务。 http 和 https 都适用于 Android 和 iOS 8 和 9。在没有身份验证的情况下连接到 http ODATA Web 服务 (http://services.odata.org/V3/OData/OData.svc/) 适用于 iOS 10,因此问题似乎与身份验证有关。

我们已经在插件中包含了以下部分:

<platform name="ios">
        <config-file target="*-Info.plist" parent="NSPhotoLibraryUsageDescription">
            <string>Für Bildvorschau wird die geräteeigene Fotogalerie verwendet</string>
        </config-file>
        <config-file target="*-Info.plist" parent="ITSAppUsesNonExemptEncryption">
            <false/>
        </config-file>
        <config-file target="*-Info.plist" parent="NSAppTransportSecurity">
            <dict><key>NSAllowsArbitraryLoads</key><true /></dict>
        </config-file>
    </platform>

这是我们正在使用的内容安全政策

<meta http-equiv="Content-Security-Policy" content="default-src * blob: data: ws: wss: gap://ready ; style-src 'self' 'unsafe-inline' 'unsafe-eval' * ;
    script-src 'self' 'unsafe-inline' 'unsafe-eval' * ; connect-src * 'self' 'unsafe-inline' 'unsafe-eval' data: blob: ws: wss: ; img-src * data: blob:">

任何想法可能是什么问题或我们可以测试什么?

【问题讨论】:

    标签: javascript web-services cordova ios10 content-security-policy


    【解决方案1】:

    这个问题似乎是 iOS 10s 处理 Digest Authentication 的一般问题,与此处描述的问题基本相同:HTTP digest authentication fail due to wrong nonce-count in iOS 10

    我们向 Apple 提出了一个错误。

    【讨论】:

      【解决方案2】:

      Apple 使用 10.2 Beta 版本解决了该问题。与 DIGEST Web 服务的连接再次成为可能。

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 2016-08-09
        • 2014-07-02
        • 1970-01-01
        • 2018-01-21
        • 1970-01-01
        • 2023-02-07
        • 1970-01-01
        • 2015-12-24
        相关资源
        最近更新 更多