Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Files fail to save when using directory #18

Open
billburgess opened this issue Apr 28, 2015 · 9 comments
Open

Files fail to save when using directory #18

billburgess opened this issue Apr 28, 2015 · 9 comments

Comments

@billburgess
Copy link

Everything seems to work when I save my files using -downloadFileForURL:progressBlock:completionBlock but I get all kinds of errors when I use -downloadFileForURL:inDirectoryNamed:progressBlock:completionBlock

The errors suggest that the files are not found in the temp directory when it tries to move them. Am I missing something?

2015-04-28 14:41:38.285 eOS[82373:16395045] ERROR: Error Domain=NSCocoaErrorDomain Code=4 "The operation couldn’t be completed. (Cocoa error 4.)" UserInfo=0x7fd07bd78320 {NSSourceFilePathErrorKey=/Users/Bill/Library/Developer/CoreSimulator/Devices/BA0758EE-3FB8-4908-B01A-3AA21B9D3361/data/Containers/Data/Application/682F7271-FA07-4303-9FA5-EFA4551FE725/Library/Caches/com.apple.nsurlsessiond/Downloads/com.redacted.ios/CFNetworkDownload_mjVG6F.tmp, NSUserStringVariant=(
Move
), NSDestinationFilePath=/Users/Bill/Library/Developer/CoreSimulator/Devices/BA0758EE-3FB8-4908-B01A-3AA21B9D3361/data/Containers/Data/Application/682F7271-FA07-4303-9FA5-EFA4551FE725/Library/Caches/schedules/IPAT_startscreen_02.pdf, NSFilePath=/Users/Bill/Library/Developer/CoreSimulator/Devices/BA0758EE-3FB8-4908-B01A-3AA21B9D3361/data/Containers/Data/Application/682F7271-FA07-4303-9FA5-EFA4551FE725/Library/Caches/com.apple.nsurlsessiond/Downloads/com.redacted.ios/CFNetworkDownload_mjVG6F.tmp, NSUnderlyingError=0x7fd07bd3b3e0 "The operation couldn’t be completed. No such file or directory"}

@seeya
Copy link

seeya commented Aug 21, 2015

Having the same problem here too.

@vanilla38
Copy link

anyone managed to fix that ?

@dasoli
Copy link

dasoli commented Oct 24, 2015

i fixed it, the guy who owns the repo dont accepts pull requests but here is the solution:

in DownloadManager.m go to Line 230 and exchange it with that:

if (download.directoryName) {
    destinationLocation = [NSURL fileURLWithPath:[NSString stringWithFormat:@"%@/%@",download.directoryName,download.fileName]];
} else {
    destinationLocation = [[self cachesDirectoryUrlPath] URLByAppendingPathComponent:download.fileName];
}

if you provide a path like that -> it works

return [NSHomeDirectory() stringByAppendingString:@"/Library/Private Documents"];

enjoy ;)

@chasseurmic
Copy link
Owner

I'm sorry, I haven't been very active on this repo lately, but of course I accept pull requests! Please make one and I'll merge it.

@Hackmodford
Copy link

It looks like the download manager does not attempt to create the directory if it doesn't exist. I'm not sure if that is the download managers problem though...

@dasoli
Copy link

dasoli commented Dec 9, 2015

At moment in my case it works.

@john916zhang
Copy link

Yes, the download manager doesn't create the directory if it doesn't exist. :-(

@RajChanchal
Copy link

@chasseurmic please update the repo with the code that @dasoli has put in. Because I did also suffered the same problem, but as soon I put in the dasoli's code, It worked fine. Thanks

@fukemy
Copy link

fukemy commented Jan 20, 2019

not working to me

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

9 participants