使用AFNetworking在UICollectionView中异步下载错误 [英] Asynchronous downloading in UICollectionView error with AFNetworking

查看:92
本文介绍了使用AFNetworking在UICollectionView中异步下载错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您好,我正在创建带有目录列表的Uicollection视图,同时点击必须下载PDF的单元格,它在一个视图中工作正常,但在另一个视图中却出现错误

Hi I'm creating Uicollection view with list ofcatalogs, While tapping on cell the PDF have to download, Its working in one view perfectly but in another view gives the error

* thread #1: tid = 0x4b2ce, 0x000000018d14f9b8 CoreFoundation`CFURLCopyScheme + 56, queue =   'com.apple.NSURLSession-work', stop reason = EXC_BAD_ACCESS (code=1, address=0x0)
frame #0: 0x000000018d14f9b8 CoreFoundation`CFURLCopyScheme + 56
frame #1: 0x000000018cdab96c CFNetwork`_urlIsHTTPish + 16
frame #2: 0x000000018cdc76b0   CFNetwork`URLRequest::addOverridingSessionAttributes(_CFURLSessionConfiguration*) + 288
frame #3: 0x000000018ce38964 CFNetwork`ClassicConnectionSession::createConnectionWithProperties(_CFURLRequest const*, __CFDictionary const*) const + 548
frame #4: 0x000000018ce10bcc CFNetwork`__73-[__NSCFLocalSessionBridge downloadTaskForRequest:resumeData:completion:]_block_invoke + 224
frame #5: 0x000000019a0abfd4 libdispatch.dylib`_dispatch_client_callout + 16
frame #6: 0x000000019a0b1c84 libdispatch.dylib`_dispatch_barrier_sync_f_invoke + 48
frame #7: 0x000000018cd977f4 CFNetwork`-[__NSCFLocalSessionTask resume] + 108
* frame #8: 0x00000001001b34d0 HSPCatalogApp`-[MRItem AsynchronousDownload12:]    (self=0x0000000170297110, _cmd=0x00000001005a3109, UrlString=0x00000001700fd800) + 548 at MRItem.m:154
frame #9: 0x00000001001b3084 HSPCatalogApp`-[MRItem downloadItem](self=0x0000000170297110, _cmd=0x0000000100599f1f) + 652 at MRItem.m:56
frame #10: 0x00000001000f7c6c HSPCatalogApp`-[HWFilterViewController collectionView:didSelectItemAtIndexPath:](self=0x0000000125568ae0, _cmd=0x00000001908d74db, collectionView=0x00000001258c2a00, indexPath=0xc000000000008016) + 960 at HWFilterViewController.m:484
frame #11: 0x0000000190428d44 UIKit`-[UICollectionView touchesEnded:withEvent:] + 448
frame #12: 0x00000001903875e0 UIKit`forwardTouchMethod + 268
frame #13: 0x00000001903875e0 UIKit`forwardTouchMethod + 268
frame #14: 0x00000001901d5df4 UIKit`_UIGestureRecognizerUpdate + 5032
frame #15: 0x0000000190213b08 UIKit`-[UIWindow _sendGesturesForEvent:] + 1012
frame #16: 0x0000000190213218 UIKit`-[UIWindow sendEvent:] + 828
frame #17: 0x00000001901e4b50 UIKit`-[UIApplication sendEvent:] + 256
frame #18: 0x00000001901e2c40 UIKit`_UIApplicationHandleEventQueue + 8500
frame #19: 0x000000018d1db7f4 CoreFoundation`__CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 24
frame #20: 0x000000018d1dab50 CoreFoundation`__CFRunLoopDoSources0 + 256
frame #21: 0x000000018d1d8de8 CoreFoundation`__CFRunLoopRun + 632
frame #22: 0x000000018d119dd0 CoreFoundation`CFRunLoopRunSpecific + 452
frame #23: 0x0000000192da9c0c GraphicsServices`GSEventRunModal + 168
frame #24: 0x000000019024afc4 UIKit`UIApplicationMain + 1156
frame #25: 0x000000010013e64c HSPCatalogApp`main(argc=1, argv=0x000000016fd17c98) + 116 at main.m:16
frame #26: 0x000000019a0c7aa0 libdyld.dylib`start + 4

预先感谢。

推荐答案

CFURLCopyScheme崩溃,因为传递给此方法的CFURL为nil,iOS7不会检查传递给NSURLSessionDownloadTask的URL是否有效。

CFURLCopyScheme crashed as CFURL passed to this method is nil, iOS7 does not check if url passed to NSURLSessionDownloadTask is valid.

检查以下内容:

1)传递给请求downloadTaskWithRequest的NSURL不为空

1) NSURL passed to request downloadTaskWithRequest was not nil

2)NSURL不包含无效字符,例如:

2) NSURL does not contain invalid characters e.g:

% |{}><"\`

这篇关于使用AFNetworking在UICollectionView中异步下载错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆