【问题标题】:iOS app crash when mfp server is down当 mfp 服务器关闭时 iOS 应用程序崩溃
【发布时间】:2016-11-23 08:21:49
【问题描述】:

我们使用 Swift 3 和 Xcode 8 开发的 iOS 应用程序连接到 MobileFirst Platform Foundation v8 服务器上的 Java 适配器。当服务器关闭时,当移动应用程序连接到 mfp 服务器时,我们会收到错误消息。步骤如下:

  1. 停止 mfp 服务器
  2. 登录移动应用
  3. mfp 登录失败,应用程序崩溃

以下是日志跟踪:

objc[63675]: Class PLBuildVersion is implemented in both /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator.sdk/System/Library/PrivateFrameworks/AssetsLibraryServices.framework/AssetsLibraryServices (0x110f65998) and /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator.sdk/System/Library/PrivateFrameworks/PhotoLibraryServices.framework/PhotoLibraryServices (0x110d8ad38). One of the two will be used. Which one is undefined.
2016-11-18 16:24:21.561 HealthKitConnector[63675:509167] -canOpenURL: failed for URL: "fbauth2:/" - error: "The operation couldn’t be completed. (OSStatus error -10814.)"
2016-11-18 16:24:21.565 HealthKitConnector[63675:509167] -canOpenURL: failed for URL: "fbauth2:/" - error: "The operation couldn’t be completed. (OSStatus error -10814.)"
2016-11-18 16:24:22.205403 HealthKitConnector[63675:509167] [MC] System group container for systemgroup.com.apple.configurationprofiles path is /Users/sudhargo/Library/Developer/CoreSimulator/Devices/EAD81986-2A0E-47B2-8C6E-CCD499B7C2AC/data/Containers/Shared/SystemGroup/systemgroup.com.apple.configurationprofiles
2016-11-18 16:24:22.205826 HealthKitConnector[63675:509167] [MC] Reading from private effective user settings.
2016-11-18 16:24:27.137331 HealthKitConnector[63675:509167] [App] if we're in the real pre-commit handler we can't actually add any new fences due to CA restriction
2016-11-18 16:24:33.846261 HealthKitConnector[63675:509167] [App] if we're in the real pre-commit handler we can't actually add any new fences due to CA restriction
User has successfully logged in.
TOKEN IS: Optional("EAAQMDtvBvmEBAGbeZAYCo8WdcqkbxM7y7mXQ81FvUDKcM81kZCIIKTOafsncm74Sr8xtxV9whsH98PpjHsvvDPWyFgeg1VdgLOXd3Ou4RLZCSRzO8P6ZC5HUyPZB1T9ZAO0CZCsRDH9ApeNMQpWoTvuPgZCHNVJs4tfGTCLlQSG5wkRgwxhD6EeaUbzTkcWdi5T516VH1ZBrXLRElIfO2Fpy93jikSYoH1MIZD")
2016-11-18 16:24:49.216 HealthKitConnector[63675:509167] Login failed Optional("Could not connect to the server.")
2016-11-18 16:24:49.229 HealthKitConnector[63675:509167] [FATAL] [WORKLIGHT] Uncaught Exception: *** -[NSDictionary initWithObjects:forKeys:]: count of objects (1) differs from count of keys (3)
2016-11-18 16:24:49.231 HealthKitConnector[63675:509167] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '*** -[NSDictionary initWithObjects:forKeys:]: count of objects (1) differs from count of keys (3)'
*** First throw call stack:
(
    0   CoreFoundation                      0x000000010210d34b __exceptionPreprocess + 171
    1   libobjc.A.dylib                     0x0000000101b6e21e objc_exception_throw + 48
    2   CoreFoundation                      0x0000000102077c9b -[NSDictionary initWithObjects:forKeys:] + 811
    3   CoreFoundation                      0x00000001020b5644 +[NSDictionary dictionaryWithObjects:forKeys:] + 52
    4   IBMMobileFirstPlatformFoundation    0x0000000100fa8d0d -[WLAuthorizationManager paramsForPreauthorizationRequestWithScope:WithCredentials:] + 429
    5   IBMMobileFirstPlatformFoundation    0x0000000100fa8022 -[WLAuthorizationManager invokePreAuthorizationRequestWithScope:WithCredentials:completionHandler:] + 722
    6   IBMMobileFirstPlatformFoundation    0x0000000100fa398e -[WLAuthorizationManager sendLoginRequest:credentials:] + 302
    7   IBMMobileFirstPlatformFoundation    0x0000000100fa476d __70-[WLAuthorizationManager login:withCredentials:withCompletionHandler:]_block_invoke311 + 125
    8   IBMMobileFirstPlatformFoundation    0x0000000100fa6e96 __81-[WLAuthorizationManager invokeInstanceRegistrationRequestWithCompletionHandler:]_block_invoke + 598
    9   IBMMobileFirstPlatformFoundation    0x0000000100fa1962 -[WLAuthorizationRequestDelegate onFailureWithResponse:userInfo:] + 642
    10  IBMMobileFirstPlatformFoundation    0x0000000100f93812 -[WLRequest requestFailed:error:] + 3506
    11  IBMMobileFirstPlatformFoundation    0x0000000100f3813e -[WLAFHTTPSessionManagerWrapper requestFailed:responseObject:error:] + 2398
    12  IBMMobileFirstPlatformFoundation    0x0000000100f36e67 __38-[WLAFHTTPSessionManagerWrapper start]_block_invoke + 295
    13  IBMMobileFirstPlatformFoundation    0x0000000100f55cfb __74-[WLAFURLSessionManagerTaskDelegate URLSession:task:didCompleteWithError:]_block_invoke + 203
    14  libdispatch.dylib                   0x000000010472b980 _dispatch_call_block_and_release + 12
    15  libdispatch.dylib                   0x00000001047550cd _dispatch_client_callout + 8
    16  libdispatch.dylib                   0x0000000104735a1d _dispatch_main_queue_callback_4CF + 733
    17  CoreFoundation                      0x00000001020d14f9 __CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE__ + 9
    18  CoreFoundation                      0x0000000102096f8d __CFRunLoopRun + 2205
    19  CoreFoundation                      0x0000000102096494 CFRunLoopRunSpecific + 420
    20  GraphicsServices                    0x000000010791fa6f GSEventRunModal + 161
    21  UIKit                               0x0000000102530964 UIApplicationMain + 159
    22  HealthKitConnector                  0x0000000100a03ebf main + 111
    23  libdyld.dylib                       0x00000001047a168d start + 1
)
libc++abi.dylib: terminating with uncaught exception of type NSException
(lldb)

【问题讨论】:

  • 添加一些代码以便我们理解。

标签: ios ibm-mobilefirst mobilefirst-adapters mobilefirst-server


【解决方案1】:

假设从错误信息来看,在这种情况下 json 响应返回 nil 。你需要在这里查字典。

if(responseDict){
   // put your code here
}

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2013-01-06
    • 2015-03-23
    • 2012-11-06
    • 1970-01-01
    • 2015-11-17
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多