【问题标题】:Not able to call adapter for iOS无法调用 iOS 适配器
【发布时间】:2016-09-13 04:03:34
【问题描述】:

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

The Error is of 403 saying: establishSSLClientAuth isCertificateExists:  false

我的 X-code 版本是 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

【问题讨论】:

  • 您能否从设备日志中发布更多信息。

标签: ibm-mobilefirst worklight-adapters worklight-server mobilefirst-server mobilefirst-studio


【解决方案1】:

您可能使用的是 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>

【讨论】:

  • 嗨 Idan,感谢您的回复,但我没有使用 iOS 9,我使用的是 iOS 7。我真的不知道为什么会出现此错误。我在 iOS 9 中也使用了您给定的方法解决方案,但它不起作用..:(
猜你喜欢
  • 1970-01-01
  • 2017-09-12
  • 1970-01-01
  • 2021-07-29
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多