TWRDownloadManager icon indicating copy to clipboard operation
TWRDownloadManager copied to clipboard

didFinishDownloadingToURL crash

Open syrakozz opened this issue 11 years ago • 9 comments

* Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '* -[NSURL URLByAppendingPathComponent:]: component, components, or pathExtension cannot be nil.' *** First throw call stack: ( 0 CoreFoundation 0x0000000103c393f5 exceptionPreprocess + 165 1 libobjc.A.dylib 0x00000001038d2bb7 objc_exception_throw + 45 2 CoreFoundation 0x0000000103c3932d +[NSException raise:format:] + 205 3 Foundation 0x00000001013af1f2 -[NSURL(NSURLPathUtilities) URLByAppendingPathComponent:] + 84 4 islami 0x00000001001c1d06 -[TWRDownloadManager URLSession:downloadTask:didFinishDownloadingToURL:] + 774 5 CFNetwork 0x0000000100a33820 __82-[NSURLSession delegate_downloadTask:didFinishDownloadingToURL:completionHandler:]_block_invoke + 38 6 Foundation 0x0000000101476ccf __NSBLOCKOPERATION_IS_CALLING_OUT_TO_A_BLOCK + 7 7 Foundation 0x00000001013b6b32 -[NSBlockOperation main] + 98 8 Foundation 0x0000000101399104 -[__NSOperationInternal _start:] + 645 9 Foundation 0x0000000101398d13 __NSOQSchedule_f + 184 10 libdispatch.dylib 0x0000000104c177f4 _dispatch_client_callout + 8 11 libdispatch.dylib 0x0000000104bffbf4 _dispatch_queue_drain + 1417 12 libdispatch.dylib 0x0000000104bff506 _dispatch_queue_invoke + 235 13 libdispatch.dylib 0x0000000104c01ff7 _dispatch_root_queue_drain + 682 14 libdispatch.dylib 0x0000000104c0363c _dispatch_worker_thread2 + 52 15 libsystem_pthread.dylib 0x0000000104fadef8 _pthread_wqthread + 314 16 libsystem_pthread.dylib 0x0000000104fb0fb9 start_wqthread + 13 ) libc++abi.dylib: terminating with uncaught exception of type NSException (lldb)

syrakozz avatar Oct 06 '14 06:10 syrakozz

It seems like there's something wrong with the file URL you are trying to download

'NSInvalidArgumentException', reason: '*** -[NSURL URLByAppendingPathComponent:]: component, components, or pathExtension cannot be nil.'

What is the URL you are passing in?

chasseurmic avatar Oct 06 '14 09:10 chasseurmic

im passing url like this http://www.mysite.com/media/xyzi-abcd-8-my-wife-intro.mp3

syrakozz avatar Oct 06 '14 14:10 syrakozz

after some debuging i notice that it goes directly to

  • (void)URLSession:(NSURLSession *)session downloadTask:(NSURLSessionDownloadTask *)downloadTask didFinishDownloadingToURL:(NSURL *)location {

and download.fileName and download.directoryName is returning nill

syrakozz avatar Oct 06 '14 14:10 syrakozz

any idea, thank you

syrakozz avatar Oct 10 '14 07:10 syrakozz

i have the same crash.why?

willingor avatar Dec 03 '14 05:12 willingor

I also have this issue and have been debugging it for a while now. Can anyone shine a light on this?

DevelopIdeas avatar Mar 13 '15 18:03 DevelopIdeas

Same problem. I can reproduce it every time by terminating the app while a download is in progress then restarting the app and accessing [TWRDownloadManager sharedManager].

It crashes because the TWRDownloadObject on line 222 of TWRDownloadManager.h is nil. It appears that NSURLSession is still attempting to complete the download, but TWRDownloadManager no longer has a reference to it in self.downloads.

bonebox avatar Mar 19 '15 14:03 bonebox

I have also tested this following what @bonebox reported, I also get this crash when I have a download running for a long time in the background. Could a possible solution be creating temp/cached download config files in the apps filesystem instead of using an array, referenced by the download location and deleting as we're done with them?

DevelopIdeas avatar Mar 23 '15 08:03 DevelopIdeas

@DevelopIdeas I have the same crash and I think that might be a good idea.

eni9889 avatar Aug 24 '15 18:08 eni9889