Ibm mobilefirst 成功连接几分钟后,Worklight本机iOS应用程序终止,出现NSRangeException
我正在使用Worklight 6.0.0.1+9-26 iFix。 在成功调用Worklight Connect几分钟后,我们的应用程序因以下错误而崩溃,该错误可能涉及Worklight的JSON解析问题:Ibm mobilefirst 成功连接几分钟后,Worklight本机iOS应用程序终止,出现NSRangeException,ibm-mobilefirst,Ibm Mobilefirst,我正在使用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
*** 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);
}
你知道怎么解决这个问题吗 这已被记录为缺陷,将在未来版本中修复。当前的解决方法是使用以下语法禁用心跳功能:
[[WLClient sharedInstance]设置心跳间隔:-1] 我试图重现你的错误,但对我有效。当我得到一个不是JSON的回复时,它也起了作用。您是否有办法显示设备从服务器收到的确切响应?(通过控制台日志或使用wireshark?)在我们的案例中,我们从connect获得了成功的响应。几分钟后,应用程序因上述错误而崩溃。也许这是运行心跳的结果,或者是将连接添加到混合中的其他副作用。啊,我明白了。除了connect和heartbeat之外,您是否向服务器发出任何手动请求?你能得到产生错误的任何调用的响应吗?你能打电话吗[[WLClient sharedInstance]setHeartBeatInterval:5];所以心跳会在5秒后触发,这样我们就可以确认它是心跳还是其他什么了?这是一个与iOS7相关的问题,复制它的步骤:1。创建一个xcode项目,只需像问题2中所做的那样调用worklight server即可。设置[[WLClient sharedInstance]setHeartBeatInterval:1];如果您针对iOS7测试项目,您将立即看到崩溃,如果您针对iOS6测试项目,您将不会看到崩溃,因为您已经向开发人员报告了问题。我们将尽快调查。这对应用程序开发有什么影响?是否有方法检查会话在服务器上是否仍处于活动状态?如果会话已运行,在调用适配器之前是否必须重新连接WLClent?heartbeat是否启用了其他功能?