我正在使用 Worklight 6.0.0.1 + 9-26 iFix。
成功调用 Worklight Connect 几分钟后,我们的应用程序崩溃并出现此错误,看起来可能涉及 Worklight 的 JSON 解析问题:
*** Terminating app due to uncaught exception 'NSRangeException', reason: '-[__NSCFConstantString substringWithRange:]: Range {2147483647, 1} out of bounds; string length 0'
*** First throw call stack:
(
0 CoreFoundation 0x021615e4 __exceptionPreprocess + 180
1 libobjc.A.dylib 0x01ee48b6 objc_exception_throw + 44
2 CoreFoundation 0x021613bb +[NSException raise:format:] + 139
3 CoreFoundation 0x0213a5e8 -[__NSCFString substringWithRange:] + 136
4 MyApp 0x00036546 +[WLUtils parseJSONString:] + 230
5 MyApp 0x00032447 -[WLRequest requestFinished:] + 167
6 libobjc.A.dylib 0x01ef681f -[NSObject performSelector:withObject:] + 70
7 MyApp 0x00058a1b -[ASIHTTPRequest reportFinished] + 171
8 libobjc.A.dylib 0x01ef681f -[NSObject performSelector:withObject:] + 70
9 Foundation 0x01b39c18 __NSThreadPerformPerform + 285
10 CoreFoundation 0x020ea8af __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 15
11 CoreFoundation 0x020ea23b __CFRunLoopDoSources0 + 235
12 CoreFoundation 0x0210730e __CFRunLoopRun + 910
13 CoreFoundation 0x02106b33 CFRunLoopRunSpecific + 467
14 CoreFoundation 0x0210694b CFRunLoopRunInMode + 123
15 GraphicsServices 0x0337f9d7 GSEventRunModal + 192
16 GraphicsServices 0x0337f7fe GSEventRun + 104
17 UIKit 0x00c5794b UIApplicationMain + 1225
18 MyApp 0x0000b9ad main + 141
19 libdyld.dylib 0x02abd725 start + 0
)
libc++abi.dylib: terminating with uncaught exception of type NSException
我们正在像这样进行连接并获得成功响应:
MyConnectListener *connectListener = [[MyConnectListener alloc] init];
[[WLClient sharedInstance] wlConnectWithDelegate:connectListener];
MyConnectListener implements WLDelegate
MyConnectListener.m:
-(void)onSuccess:(WLResponse *)response
{
NSLog(@"Connection Success: %@", response);
}
-(void)onFailure:(WLFailResponse *)response
{
NSLog(@"Connection failure: %@", response);
}
知道如何解决这个问题吗?
最佳答案
这已被记录为缺陷,并将在 future 版本中修复。当前的解决方法是使用以下语法禁用心跳功能:
[[WLClient sharedInstance] setHeartBeatInterval:-1];
关于ibm-mobilefirst - 成功连接几分钟后,Worklight Native iOS 应用程序以 NSRangeException 终止,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/19595567/