1

我正在使用IBM Worklight Version 6.2.I製作了混合應用程序。我能夠製作並部署.apk文件,運行良好。但是當我爲iPhone添加環境時。我在X代碼中導入了該文件夾並運行該項目文件。應用程序運行良好,但我無法獲得適配器的響應。下面是我得到的例外。無法爲iOS調用適配器

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 
+0

是否可以從設備日誌發佈更多。 –

回答

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> 
+1

嗨伊丹,謝謝你的回覆,但我沒有使用iOS 9,我使用iOS 7.我真的不知道爲什麼我得到這個錯誤。我試過這也在iOS 9與您給定的解決方案,但它不工作.. :( – Dss