我们使用Swift 3和Xcode 8开发的iOS应用程序连接到MobileFirst Platform Foundation v8服务器上的Java Adapter。当服务器关闭时移动应用程序连接到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)
答案 0 :(得分:1)
假设从错误消息中,json响应在这种情况下返回nil。你需要在这里检查字典。
if(responseDict){
// put your code here
}