iOS MobileFirst 7.1 应用程序在工作灯连接时出错

Posted

技术标签:

【中文标题】iOS MobileFirst 7.1 应用程序在工作灯连接时出错【英文标题】:iOS MobileFirst 7.1 Application giving error while worklight connection 【发布时间】:2016-11-24 11:07:41 【问题描述】:

我们已经使用 Worklight 6.1 创建了 iosandroid 应用程序。最近我们将其迁移到 Mobile First 7.1。

进行迁移后,android 应用程序运行良好。但在 iOS 中,我们遇到了错误。由于哪个应用程序给出错误

WL.Client.connect(
                    onSuccess: onConnectSuccessMFS,
                    onFailure: onConnectFailureMFS
             ); 

这里onConnectFailureMFS函数由于连接未建立而被调用。

  2016-11-24 16:24:24.902 XXXXXXXX[16439:163898] DiskCookieStorage changing policy from 2 to 0, cookie file: file:///Users/winjit-suyog/Library/Developer/CoreSimulator/Devices/85363033-091B-4B86-8543-815FE0C47D8D/data/Containers/Data/Application/3A4AA94E-4325-4BFB-9106-D3932FF84305/Library/Cookies/com.xxx.mobilebankingiphone.binarycookies
2016-11-24 16:24:25.078 XXXXXXXX[16439:163898] [DEBUG] [WL_SPLASH] -[WLSplashView updateImage] in WLSplashView.m:189 :: Splash screen image is taken from UILaunchImages: Default-667h
2016-11-24 16:24:25.184 XXXXXXXX[16439:163898] [DEBUG] [WL_SPLASH] -[WLSplashView updateImage] in WLSplashView.m:189 :: Splash screen image is taken from UILaunchImages: Default-667h
2016-11-24 16:24:25.186 XXXXXXXX[16439:163898] Unbalanced calls to begin/end appearance transitions for <UIViewController: 0x7fc87341d920>.
2016-11-24 16:24:25.201 XXXXXXXX[16439:164046] [DEBUG] [WL_CONFIG] -[WLConfig init] in WLConfig.m:71 :: 
    "application id" = "xxx_iBank";
    "application version" = "4.0";
    authenticitySharedData = "$authenticitySharedData";
    buildtime = 1479984854;
    environment = iphone;
    host = "hostname";
    ignoredFileExtensions = "";
    platformVersion = "7.1.0.0";
    port = 443;
    protocol = https;
    testWebResourcesChecksum = false;
    wlAppFamily = "";
    wlMainFile = "index.html";
    wlSecureDirectUpdatePublicKey = "";
    wlServerContext = "/qa/";
    wlShareCookies = "";
    wlShareUserCert = false;
    wlUid = "kGGREBVfLjxh/6KrBskjhg==";

2016-11-24 16:24:25.202 XXXXXXXX[16439:164046] [DEBUG] [WL_INIT] -[WLImpl initWL] in WLImpl.m:126 :: At first launch
2016-11-24 16:24:25.203 XXXXXXXX[16439:164046] [DEBUG] [WL_INIT] -[WLImpl initWL] in WLImpl.m:152 :: Web resources should not be extracted.
2016-11-24 16:24:26.605 XXXXXXXX[16439:163898] Apache Cordova native platform version 3.7.0 is starting.
2016-11-24 16:24:26.605 XXXXXXXX[16439:163898] Multi-tasking -> Device: YES, App: YES
2016-11-24 16:24:26.622 XXXXXXXX[16439:163898] Unlimited access to network resources
2016-11-24 16:24:26.624 XXXXXXXX[16439:163898] 

Started backup to iCloud! Please be careful.
Your application might be rejected by Apple if you store too much data.
For more information please read "iOS Data Storage Guidelines" at:
https://developer.apple.com/icloud/documentation/data-storage/
To disable web storage backup to iCloud, set the BackupWebStorage preference to "local" in the Cordova config.xml file

2016-11-24 16:24:26.628 XXXXXXXX[16439:163898] [CDVTimer][wlapp] 0.116050ms
2016-11-24 16:24:26.629 XXXXXXXX[16439:163898] [CDVTimer][push] 0.171006ms
2016-11-24 16:24:26.629 XXXXXXXX[16439:163898] [CDVTimer][TotalPluginStartup] 0.751972ms
2016-11-24 16:24:26.745 XXXXXXXX[16439:163898] Resetting plugins due to page load.
2016-11-24 16:24:29.532 XXXXXXXX[16439:164028] [WARN] [NONE] Initialization option 'connectOnStartup' is deprecated. Use WL.Client.connect() to connect to the IBM MobileFirst Platform Server.
2016-11-24 16:24:29.538 XXXXXXXX[16439:163898] log1
2016-11-24 16:24:29.597 XXXXXXXX[16439:163999] [DEBUG] [NONE] ondeviceready event dispatched
2016-11-24 16:24:29.598 XXXXXXXX[16439:164008] [WARN] [NONE] Initialization option 'analytics' is deprecated. Use WL.Analytics.enable/disable to set analytics data capture.
2016-11-24 16:24:29.599 XXXXXXXX[16439:164095] [DEBUG] [NONE] wlclient init started
2016-11-24 16:24:29.600 XXXXXXXX[16439:164093] [DEBUG] [NONE] Read cookies: null
2016-11-24 16:24:29.600 XXXXXXXX[16439:164094] [DEBUG] [NONE] CookieMgr read cookies: 
2016-11-24 16:24:29.612 XXXXXXXX[16439:163898] [DEBUG] [WL_AUTH] -[WLDeviceAuthManager getWLUniqueDeviceId] in WLDeviceAuthManager.m:85 :: returning UUID from the keychain
2016-11-24 16:24:29.619 XXXXXXXX[16439:163898] THREAD WARNING: ['DeviceAuth'] took '75.402832' ms. Plugin should use a background thread.
2016-11-24 16:24:29.620 XXXXXXXX[16439:164093] [DEBUG] [NONE] before: initOptions.onSuccess
2016-11-24 16:24:29.622 XXXXXXXX[16439:164093] [DEBUG] [NONE] establishSSLClientAuth
2016-11-24 16:24:29.624 XXXXXXXX[16439:164093] [DEBUG] [NONE] after: initOptions.onSuccess
2016-11-24 16:24:29.625 XXXXXXXX[16439:164008] [DEBUG] [NONE] added onPause and onResume event handlers
2016-11-24 16:24:29.626 XXXXXXXX[16439:164095] [DEBUG] [NONE] wlclient init success
2016-11-24 16:24:29.627 XXXXXXXX[16439:163898] [WARN] [USER_CERT_AUTH] +[WLUserAuthManager getCertificateIdentifier] in WLUserAuthManager.m:68 :: Certificate Identifier Key: com.worklight.userenrollment.certificate:com.xxx.mobilebankingiphone
2016-11-24 16:24:29.627 XXXXXXXX[16439:164094] [DEBUG] [WORKLIGHT] +[WLClient sharedInstance] in WLClient.m:165 :: IBMMobilieFirstFoundation.framework version = 7.1-2016/08/01 23:35:44
2016-11-24 16:24:29.632 XXXXXXXX[16439:163898] [DEBUG] [WL_AUTH] -[WLDeviceAuthManager getWLUniqueDeviceId] in WLDeviceAuthManager.m:85 :: returning UUID from the keychain
2016-11-24 16:24:29.729 XXXXXXXX[16439:163898] THREAD WARNING: ['DeviceAuth'] took '96.157959' ms. Plugin should use a background thread.
2016-11-24 16:24:29.755 XXXXXXXX[16439:163898] [DEBUG] [WORKLIGHT] +[WLClient sharedInstance] in WLClient.m:165 :: IBMMobilieFirstFoundation.framework version = 7.1-2016/08/01 23:35:44
2016-11-24 16:24:30.009 XXXXXXXX[16439:164008] [DEBUG] [NONE] establishSSLClientAuth isCertificateExists:  false
2016-11-24 16:24:30.010 XXXXXXXX[16439:164093] [DEBUG] [NONE] Request [/apps/services/api/xxx_iBank/iphone/init]
2016-11-24 16:24:30.039 XXXXXXXX[16439:163898] [DEBUG] [WORKLIGHT] +[WLClient sharedInstance] in WLClient.m:165 :: IBMMobilieFirstFoundation.framework version = 7.1-2016/08/01 23:35:44
2016-11-24 16:24:30.040 XXXXXXXX[16439:163898] [DEBUG] [WL_AUTH] -[WLAuthorizationManager invokeInstanceRegistrationRequestWithCompletionHandler:] in WLAuthorizationManager.m:548 :: Call instance registration endpoint
2016-11-24 16:24:30.043 XXXXXXXX[16439:163898] [DEBUG] [WL_AUTH] -[WLDeviceAuthManager getWLUniqueDeviceId] in WLDeviceAuthManager.m:85 :: returning UUID from the keychain
2016-11-24 16:24:30.279 XXXXXXXX[16439:163898] [DEBUG] [CERTIFICATE_MANAGER] +[WLCertManager generateKeyPair:withPublicKeyLabel:withKeySize:] in WLCertManager.m:225 :: generateKeyPair generating keypair --> Success
2016-11-24 16:24:30.286 XXXXXXXX[16439:163898] [DEBUG] [WORKLIGHT] +[WLClient sharedInstance] in WLClient.m:165 :: IBMMobilieFirstFoundation.framework version = 7.1-2016/08/01 23:35:44
2016-11-24 16:24:30.292 XXXXXXXX[16439:163898] [DEBUG] [WL_AFHTTPRequestOperationManagerWrapper_PACKAGE] +[WLAFHTTPRequestOperationManagerWrapper requestWithURL:] in WLAFHTTPRequestOperationManagerWrapper.m:51 :: Request url is https://hostname:443/qa/authorization/v1/clients/instance
2016-11-24 16:24:30.310 XXXXXXXX[16439:163898] [DEBUG] [WL_REQUEST] -[WLRequest sendRequest:path:withOptions:] in WLRequest.m:142 :: Request timeout is 10.000000
2016-11-24 16:24:30.315 XXXXXXXX[16439:163898] [DEBUG] [WL_AUTH] -[WLDeviceAuthManager getWLUniqueDeviceId] in WLDeviceAuthManager.m:85 :: returning UUID from the keychain
2016-11-24 16:24:30.323 XXXXXXXX[16439:163898] [DEBUG] [WL_REQUEST] -[WLRequest sendRequest:path:withOptions:] in WLRequest.m:244 :: Sending request (https://hostname:443/qa/authorization/v1/clients/instance) with headers: 

    "Accept-Language" = en;
    "User-Agent" = "XXXXXXXX/1.0 (iPhone; iOS 9.3; Scale/2.00)/WLNativeAPI/7.1.0.0";
    "X-Requested-With" = XMLHttpRequest;
    "x-wl-app-version" = "4.0";
    "x-wl-device-id" = "4B0C5DE7-6507-46B5-98A8-A455BB43BC5C";
    "x-wl-platform-version" = "7.1.0.0";

You can see the request body in the Analytics platform logs.
2016-11-24 16:24:30.326 XXXXXXXX[16439:163898] [DEBUG] [WL_AFHTTPRequestOperationManagerWrapper_PACKAGE] -[WLAFHTTPRequestOperationManagerWrapper start] in WLAFHTTPRequestOperationManagerWrapper.m:356 :: Starting the request with URL https://hostname:443/qa/authorization/v1/clients/instance
2016-11-24 16:24:30.327 XXXXXXXX[16439:163898] [DEBUG] [WL_REQUEST] __42-[WLRequest sendRequest:path:withOptions:]_block_invoke in WLRequest.m:254 :: waiting for response... (Thread=<NSThread: 0x7fc8734065c0>number = 1, name = main)
2016-11-24 16:24:30.328 XXXXXXXX[16439:163898] THREAD WARNING: ['WLAuthorizationManagerPlugin'] took '573.004883' ms. Plugin should use a background thread.
2016-11-24 16:24:39.274 XXXXXXXX[16439:163898] [DEBUG] [WL_AFHTTPRequestOperationManagerWrapper_PACKAGE] -[WLAFHTTPRequestOperationManagerWrapper requestFailed:error:] in WLAFHTTPRequestOperationManagerWrapper.m:388 :: Request Failed
2016-11-24 16:24:39.275 XXXXXXXX[16439:163898] [DEBUG] [WL_AFHTTPRequestOperationManagerWrapper_PACKAGE] -[WLAFHTTPRequestOperationManagerWrapper requestFailed:error:] in WLAFHTTPRequestOperationManagerWrapper.m:389 :: Response Status Code : 0
2016-11-24 16:24:39.276 XXXXXXXX[16439:163898] [DEBUG] [WL_AFHTTPRequestOperationManagerWrapper_PACKAGE] -[WLAFHTTPRequestOperationManagerWrapper requestFailed:error:] in WLAFHTTPRequestOperationManagerWrapper.m:390 :: Response Error : Could not connect to the server.
2016-11-24 16:24:39.277 XXXXXXXX[16439:163898] [DEBUG] [WORKLIGHT] +[WLClient sharedInstance] in WLClient.m:165 :: IBMMobilieFirstFoundation.framework version = 7.1-2016/08/01 23:35:44
2016-11-24 16:24:39.277 XXXXXXXX[16439:163898] [ERROR] [WL_REQUEST] -[WLRequest requestFailed:error:] in WLRequest.m:509 :: Status code='0' error='Could not connect to the server.' response='(null)'
2016-11-24 16:24:39.278 XXXXXXXX[16439:163898] [DEBUG] [WL_REQUEST] -[WLRequest requestFailed:error:] in WLRequest.m:512 :: Response Header: (null)
Response Data: (null)
2016-11-24 16:24:39.279 XXXXXXXX[16439:163898] [DEBUG] [WL_AUTH] -[WLAuthorizationManager failRegistratioWithResponse:] in WLAuthorizationManager.m:866 :: Response does not contain a valid certificate and client Id. device registration failed
2016-11-24 16:24:39.282 XXXXXXXX[16439:163898] [DEBUG] [CERTIFICATE_MANAGER] +[WLCertManager removeKey:] in WLCertManager.m:262 :: Key was successfully removed.
2016-11-24 16:24:39.285 XXXXXXXX[16439:163898] [DEBUG] [CERTIFICATE_MANAGER] +[WLCertManager removeKey:] in WLCertManager.m:262 :: Key was successfully removed.
2016-11-24 16:24:39.288 XXXXXXXX[16439:163898] [DEBUG] [WORKLIGHT] +[WLClient sharedInstance] in WLClient.m:165 :: IBMMobilieFirstFoundation.framework version = 7.1-2016/08/01 23:35:44
2016-11-24 16:24:39.295 XXXXXXXX[16439:163898] [DEBUG] [WORKLIGHT] +[WLClient sharedInstance] in WLClient.m:165 :: IBMMobilieFirstFoundation.framework version = 7.1-2016/08/01 23:35:44
2016-11-24 16:24:39.300 XXXXXXXX[16439:163898] [DEBUG] [WORKLIGHT] +[WLClient sharedInstance] in WLClient.m:165 :: IBMMobilieFirstFoundation.framework version = 7.1-2016/08/01 23:35:44
2016-11-24 16:24:39.301 XXXXXXXX[16439:163898] [DEBUG] [WL_AUTH] -[WLAuthorizationManager invokeInstanceRegistrationRequestWithCompletionHandler:] in WLAuthorizationManager.m:548 :: Call instance registration endpoint
2016-11-24 16:24:39.301 XXXXXXXX[16439:163898] [DEBUG] [WL_AUTH] -[WLDeviceAuthManager getWLUniqueDeviceId] in WLDeviceAuthManager.m:85 :: returning UUID from the keychain
2016-11-24 16:24:39.328 XXXXXXXX[16439:163898] [DEBUG] [CERTIFICATE_MANAGER] +[WLCertManager generateKeyPair:withPublicKeyLabel:withKeySize:] in WLCertManager.m:225 :: generateKeyPair generating keypair --> Success
2016-11-24 16:24:39.333 XXXXXXXX[16439:163898] [DEBUG] [WORKLIGHT] +[WLClient sharedInstance] in WLClient.m:165 :: IBMMobilieFirstFoundation.framework version = 7.1-2016/08/01 23:35:44
2016-11-24 16:24:39.334 XXXXXXXX[16439:163898] [DEBUG] [WL_AFHTTPRequestOperationManagerWrapper_PACKAGE] +[WLAFHTTPRequestOperationManagerWrapper requestWithURL:] in WLAFHTTPRequestOperationManagerWrapper.m:51 :: Request url is https://hostname:443/qa/authorization/v1/clients/instance
2016-11-24 16:24:39.335 XXXXXXXX[16439:163898] [DEBUG] [WL_REQUEST] -[WLRequest sendRequest:path:withOptions:] in WLRequest.m:142 :: Request timeout is 10.000000
2016-11-24 16:24:39.336 XXXXXXXX[16439:163898] [DEBUG] [WL_AUTH] -[WLDeviceAuthManager getWLUniqueDeviceId] in WLDeviceAuthManager.m:85 :: returning UUID from the keychain
2016-11-24 16:24:39.337 XXXXXXXX[16439:163898] [DEBUG] [WL_REQUEST] -[WLRequest sendRequest:path:withOptions:] in WLRequest.m:244 :: Sending request (https://hostname:443/qa/authorization/v1/clients/instance) with headers: 

    "Accept-Language" = en;
    "User-Agent" = "XXXXXXXX/1.0 (iPhone; iOS 9.3; Scale/2.00)/WLNativeAPI/7.1.0.0";
    "X-Requested-With" = XMLHttpRequest;
    "x-wl-app-version" = "4.0";
    "x-wl-device-id" = "4B0C5DE7-6507-46B5-98A8-A455BB43BC5C";
    "x-wl-platform-version" = "7.1.0.0";

You can see the request body in the Analytics platform logs.
2016-11-24 16:24:39.347 XXXXXXXX[16439:163898] [DEBUG] [WL_AFHTTPRequestOperationManagerWrapper_PACKAGE] -[WLAFHTTPRequestOperationManagerWrapper start] in WLAFHTTPRequestOperationManagerWrapper.m:356 :: Starting the request with URL https://hostname:443/qa/authorization/v1/clients/instance
2016-11-24 16:24:39.349 XXXXXXXX[16439:163898] [DEBUG] [WL_REQUEST] __42-[WLRequest sendRequest:path:withOptions:]_block_invoke in WLRequest.m:254 :: waiting for response... (Thread=<NSThread: 0x7fc8734065c0>number = 1, name = main)
2016-11-24 16:24:39.349 XXXXXXXX[16439:163898] THREAD WARNING: ['WLAuthorizationManagerPlugin'] took '53.093750' ms. Plugin should use a background thread.
2016-11-24 16:24:40.836 XXXXXXXX[16439:163898] Finished load of: file:///Users/winjit-suyog/Library/Developer/CoreSimulator/Devices/85363033-091B-4B86-8543-815FE0C47D8D/data/Containers/Bundle/Application/2F150F10-8D15-4AB7-8B7B-A867EDB1BA1D/XXXXXXXX.app/www/default/index.html#menu
2016-11-24 16:24:45.081 XXXXXXXX[16439:163898] [DEBUG] [WL_AFHTTPRequestOperationManagerWrapper_PACKAGE] -[WLAFHTTPRequestOperationManagerWrapper requestFailed:error:] in WLAFHTTPRequestOperationManagerWrapper.m:388 :: Request Failed
2016-11-24 16:24:45.082 XXXXXXXX[16439:163898] [DEBUG] [WL_AFHTTPRequestOperationManagerWrapper_PACKAGE] -[WLAFHTTPRequestOperationManagerWrapper requestFailed:error:] in WLAFHTTPRequestOperationManagerWrapper.m:389 :: Response Status Code : 0
2016-11-24 16:24:45.083 XXXXXXXX[16439:163898] [DEBUG] [WL_AFHTTPRequestOperationManagerWrapper_PACKAGE] -[WLAFHTTPRequestOperationManagerWrapper requestFailed:error:] in WLAFHTTPRequestOperationManagerWrapper.m:390 :: Response Error : Could not connect to the server.
2016-11-24 16:24:45.084 XXXXXXXX[16439:163898] [DEBUG] [WORKLIGHT] +[WLClient sharedInstance] in WLClient.m:165 :: IBMMobilieFirstFoundation.framework version = 7.1-2016/08/01 23:35:44
2016-11-24 16:24:45.084 XXXXXXXX[16439:163898] [ERROR] [WL_REQUEST] -[WLRequest requestFailed:error:] in WLRequest.m:509 :: Status code='0' error='Could not connect to the server.' response='(null)'
2016-11-24 16:24:45.085 XXXXXXXX[16439:163898] [DEBUG] [WL_REQUEST] -[WLRequest requestFailed:error:] in WLRequest.m:512 :: Response Header: (null)
Response Data: (null)
2016-11-24 16:24:45.086 XXXXXXXX[16439:163898] [DEBUG] [WL_AUTH] -[WLAuthorizationManager failRegistratioWithResponse:] in WLAuthorizationManager.m:866 :: Response does not contain a valid certificate and client Id. device registration failed
2016-11-24 16:24:45.089 XXXXXXXX[16439:163898] [DEBUG] [CERTIFICATE_MANAGER] +[WLCertManager removeKey:] in WLCertManager.m:262 :: Key was successfully removed.
2016-11-24 16:24:45.092 XXXXXXXX[16439:163898] [DEBUG] [CERTIFICATE_MANAGER] +[WLCertManager removeKey:] in WLCertManager.m:262 :: Key was successfully removed.
2016-11-24 16:24:45.095 XXXXXXXX[16439:163898] [DEBUG] [WORKLIGHT] +[WLClient sharedInstance] in WLClient.m:165 :: IBMMobilieFirstFoundation.framework version = 7.1-2016/08/01 23:35:44

我们尝试了 SO 上可用的不同解决方案。但无法解决。

【问题讨论】:

【参考方案1】:

确保您已在服务器上启用 TLS 1.2 并已在 iOS 中配置 ATS 以通过 HTTPS 连接,因为现在这是生产系统中的要求。

如果这是在开发过程中,那么您可以禁用 ATS 以继续开发。

在此处阅读更多信息:https://mobilefirstplatform.ibmcloud.com/blog/2015/09/09/ats-and-bitcode-in-ios9/

【讨论】:

我们已经关注了这个链接,但仍然遇到问题。对于本地主机,它工作正常。 可能是您的网址配置错误。 我观察到此日志“注册应用程序时响应无效”。你能告诉我为什么我得到这个。此响应在上述日志以下一段时间后出现【参考方案2】:

我遇到了 iOS 11 和我们在 apache2 上运行的应用程序之一特有的类似问题。

尝试在您的网络服务器上禁用 HTTP2。在我的虚拟主机中禁用它后,网站又开始正常运行。

【讨论】:

以上是关于iOS MobileFirst 7.1 应用程序在工作灯连接时出错的主要内容,如果未能解决你的问题,请参考以下文章

IBM MobileFirst 7.1 推送订阅用户标识为空

MobileFirst 7.1 构建所有环境未创建 android 文件夹

在 MobileFirst Platform Foundation 7.1 中构建迁移的项目时出错

向后兼容在 MobileFirst 8.0 服务器中运行的 7.1 应用程序

MobileFirst 7.1 Progurd 获取错误返回代码 1

在 MobileFirst 7.1 中创建“Cordova”风格的应用程序时,MobileFirst 客户端 API(例如 WL.App.sendActionToNative)是不是可用?