gpt4 book ai didi

ios - 使用 AFNetworking 在 UICollectionView 中异步下载错误

转载 作者:行者123 更新时间:2023-11-29 10:39:21 26 4
gpt4 key购买 nike

您好,我正在创建带有目录列表的 Uicollection View ,点击单元格时 PDF 必须下载,它在一个 View 中工作完美,但在另一个 View 中给出错误

* 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 是否有效。

检查:

1) 传递给请求 downloadTaskWithRequest 的 NSURL 不是 nil

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

% |{}><"\`

关于ios - 使用 AFNetworking 在 UICollectionView 中异步下载错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25266727/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com