Ios 如何使用URLSessionManager取消NSURLSessionDownloadTask?
我想用AFURLSessionManager方法Ios 如何使用URLSessionManager取消NSURLSessionDownloadTask?,ios,afnetworking,nsurlsessiondownloadtask,Ios,Afnetworking,Nsurlsessiondownloadtask,我想用AFURLSessionManager方法@selector(collectionAction)下载一些图片: 数字在不断滚动,然后我的iPhone几乎停止工作。因此,如果其中任何一项任务失败,我想取消这些任务。但是使用[manager invalidateSessionCancelingTasks:YES]或[manager.operationQueue cancelAllOperations]我有另一个错误 2014-12-02 11:34:13.040 MoneyPower[1121
@selector(collectionAction)
下载一些图片:
数字在不断滚动,然后我的iPhone几乎停止工作。因此,如果其中任何一项任务失败,我想取消这些任务。但是使用[manager invalidateSessionCancelingTasks:YES]代码>或[manager.operationQueue cancelAllOperations]代码>我有另一个错误
2014-12-02 11:34:13.040 MoneyPower[11216:1204788] *** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'An instance 0x17947310 of class __NSCFLocalDownloadTask was deallocated while key value observers were still registered with it. Current observation info: <NSKeyValueObservationInfo 0x179449e0> (<NSKeyValueObservance 0x17944b40: Observer: 0x1785d3a0, Key path: state, Options: <New: YES, Old: YES, Prior: NO> Context: 0x3992cc, Property: 0x179462a0>)'
*** First throw call stack:(0x227ddc1f 0x2ffc4c8b 0x227ddb65 0x23485c25 0x2ffded5f 0x2229cb89 0x2ffded5f 0x3055fae1 0x3055fae1 0x836e29 0x8312c9 0x838567 0x839891 0x30685e31 0x30685b84)libc++abi.dylib: terminating with uncaught exception of type NSException
2014-12-02 11:34:13.040 MoneyPower[11216:1204788]***由于未捕获的异常“NSInternalInconsistencyException”而终止应用程序,原因是:“在仍向其注册键值观察者的同时,释放了类u NSCFLocalDownloadTask的实例0x17947310。”。当前观测信息:()'
***第一次抛出调用堆栈:(0x227ddc1f 0x2ffc4c8b 0x227ddb65 0x23485c25 0x2ffded5f 0x2229cb89 0x2ffded5f 0x3055fae1 0x836e29 0x8312c9 0x838567 0x839891 0x30685e31 0x30685b84)libc++abi.dylib:以NSException类型的未捕获异常终止
我该怎么处理呢?嗨,我遇到了和你一样的问题。你解决了吗?你是怎么做到的?提前谢谢。@Lilac很抱歉告诉你,我没有找到任何解决办法,我只是放手了。没关系。我通过使用NSURLSession而不使用AFNetworking来解决此问题。:P
2014-12-02 11:34:09.711 MoneyPower[11216:1204579] File downloaded to: (null)
2014-12-02 11:34:12.936 MoneyPower[11216:1204579] File downloaded to: (null)
2014-12-02 11:34:12.951 MoneyPower[11216:1204579] File downloaded to: (null)
2014-12-02 11:34:13.040 MoneyPower[11216:1204788] *** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'An instance 0x17947310 of class __NSCFLocalDownloadTask was deallocated while key value observers were still registered with it. Current observation info: <NSKeyValueObservationInfo 0x179449e0> (<NSKeyValueObservance 0x17944b40: Observer: 0x1785d3a0, Key path: state, Options: <New: YES, Old: YES, Prior: NO> Context: 0x3992cc, Property: 0x179462a0>)'
*** First throw call stack:(0x227ddc1f 0x2ffc4c8b 0x227ddb65 0x23485c25 0x2ffded5f 0x2229cb89 0x2ffded5f 0x3055fae1 0x3055fae1 0x836e29 0x8312c9 0x838567 0x839891 0x30685e31 0x30685b84)libc++abi.dylib: terminating with uncaught exception of type NSException