2

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

thanks in advance.

Murali
  • 500
  • 5
  • 22
  • 1
    You should share code, but I'd check to make sure your `NSURL` was not nil. This can easily happen if the URL contains characters that need to be percent escaped (notably, spaces) or if you neglected to include the scheme (e.g. you use `www.example.com/path` instead of `http://www.example.com/path`). – Rob Aug 13 '14 at 17:17
  • Have similar issue, @Murali did you find any solution? – Igor Palaguta Jun 29 '15 at 08:32

1 Answers1

2

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

Check that:

1) NSURL passed to request downloadTaskWithRequest was not nil

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

% |{}><"\`
Igor Palaguta
  • 3,579
  • 2
  • 20
  • 32