objective-c – 有没有办法停止所有RestKit处理?
发布时间:2020-12-16 07:01:31 所属栏目:百科 来源:网络整理
导读:我在RestKit的错误回调中切换控制器时遇到问题.它会导致错误: *** -[RKObjectLoader onDidFailWithError]: message sent to deallocated instance 0x1ddd9680 我正在使用此代码切换方法 – (void)objectLoader:(RKObjectLoader *)objectLoader didFailWith
我在RestKit的错误回调中切换控制器时遇到问题.它会导致错误:
*** -[RKObjectLoader onDidFailWithError]: message sent to deallocated instance 0x1ddd9680 我正在使用此代码切换方法 – (void)objectLoader:(RKObjectLoader *)objectLoader didFailWithError:(NSError *)错误: [[[[RKObjectManager sharedManager] client] requestQueue] cancelAllRequests]; scAppDelegate *appDelegate = (scAppDelegate *)[UIApplication sharedApplication].delegate; WelcomeController *controller = [[WelcomeController alloc] init]; [controller createWelcome]; appDelegate.window.rootViewController = controller; [appDelegate.window addSubview:[controller view]]; [appDelegate.window makeKeyAndVisible]; 我的问题出在第一行,因为它不会取消所有RestKit处理.在日志中,我看到一些ObjectMapping操作,它们导致EXC_BAD_ACCESS(SIGSEGV)错误.我找到了一个解决方法 – 延迟后切换控制器(使用performSelector:withObject:afterDelay).但我正在寻找更好的解决方案. ObjectMapping操作是: 2012-09-26 14:50:09.408 dr[5004:907] W restkit.object_mapping:RKObjectMapper.m:87 Adding mapping error: Could not find an object mapping for keyPath: '' 2012-09-26 14:50:09.410 dr[5004:907] E restkit.network:RKObjectLoader.m:231 Encountered errors during mapping: Could not find an object mapping for keyPath: '' 2012-09-26 14:50:09.411 dr[5004:907] E restkit.network:RKObjectLoader.m:360 Encountered an error while attempting to map server side errors from payload: Could not find an object mapping for keyPath: '' 2012-09-26 14:50:09.419 dr[5004:907] I restkit.support:RKCache.m:189 Invalidating cache at path: /var/mobile/Applications/1B9919DC-0674-494D-9C26-F1FC1925E856/Library/Caches/RKClientRequestCache-dr.cloudapp.net/SessionStore 2012-09-26 14:50:09.422 dr[5004:907] I restkit.network.reachability:RKReachabilityObserver.m:123 Reachability observer initialized with IP address: 0.0.0.0. 我正在使用最新版本的RestKit. 解决方法
来自RestKit 0.20.0:
[[[RKObjectManager sharedManager] operationQueue] cancelAllOperations]; (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |