1

我正在使用 IBM Worklight 版本 6.2。我制作了一个混合应用程序。我能够制作和部署.apk文件并且运行良好。但是当我为 iPhone 添加环境时。我在 X Code 中导入该文件夹并运行该项目文件。应用程序运行良好,但我无法从适配器获得响应。下面是我得到的例外。

The Error is of 403 saying: establishSSLClientAuth isCertificateExists:  false

我的 X 代码版本是 6.1

请帮我解决这个问题

2016-05-17 12:40:42.277 mServe[683:138427] [DEBUG] [NONE] establishSSLClientAuth
2016-05-17 12:40:42.284 mServe[683:138394] [WARN] [USER_CERT_AUTH] +[WLUserAuthManager getCertificateIdentifier] in WLUserAuthManager.m:68 :: Certificate Identifier Key: com.worklight.userenrollment.certificate:com.mServe
2016-05-17 12:40:42.301 mServe[683:138394] THREAD WARNING: ['UserAuth'] took '17.668701' ms. Plugin should use a background thread.
2016-05-17 12:40:42.305 mServe[683:138477] [DEBUG] [NONE] Request [http://10.1.54.101:10080/Android/apps/services/api/mServe/iphone/query]
2016-05-17 12:40:42.310 mServe[683:138427] [DEBUG] [NONE] establishSSLClientAuth isCertificateExists:  false
2016-05-17 12:40:42.488 mServe[683:138394] [ERROR] [WL_AFHTTPCLIENTWRAPPER_PACKAGE] -[WLAFHTTPClientWrapper requestFailed:error:] in WLAFHTTPClientWrapper.m:216 :: Request Failed
2016-05-17 12:40:42.494 mServe[683:138394] [ERROR] [WL_AFHTTPCLIENTWRAPPER_PACKAGE] -[WLAFHTTPClientWrapper requestFailed:error:] in WLAFHTTPClientWrapper.m:217 :: Response Status Code : 403
2016-05-17 12:40:42.500 mServe[683:138394] [ERROR] [WL_AFHTTPCLIENTWRAPPER_PACKAGE] -[WLAFHTTPClientWrapper requestFailed:error:] in WLAFHTTPClientWrapper.m:218 :: Response Error : Expected status code in (200-299), got 403
4

1 回答 1

0

您很可能使用的是 iOS 9。默认情况下,iOS 9 使用一种称为 ATS(应用程序传输安全)的新安全措施。在开发过程中,您可以禁用它以使网络请求成功通过。

请在此处查看:https ://mobilefirstplatform.ibmcloud.com/blog/2015/09/09/ats-and-bitcode-in-ios9/

本质上,您需要在 Xcode 中通过添加以下内容来编辑应用程序的 .plist 文件:

<key>NSAppTransportSecurity</key>
<dict>
  <key>NSExceptionDomains</key>
  <dict>
    <key>localhost</key>
    <dict>
      <!--Include to allow HTTP requests-->
      <key>NSTemporaryExceptionAllowsInsecureHTTPLoads</key>
      <true/>
    </dict>
  </dict>
</dict>
于 2016-05-17T08:03:48.420 回答