nsfilemanager - IOS: Moving file to directory -


i have code , error text:

error: error domain=nscocoaerrordomain code=4 "the operation couldn’t completed. (cocoa error 4.)" userinfo=0x145b5a60 {nssourcefilepatherrorkey=/private/var/mobile/containers/data/application/e905fe5a-c39b-41f0-8bc7-fc58cc3f4306/library/caches/2d0404ee-746c-4c1e-98f3-42ffe485be3b.zip, nsuserstringvariant=( move ), nsfilepath=/private/var/mobile/containers/data/application/e905fe5a-c39b-41f0-8bc7-fc58cc3f4306/library/caches/2d0404ee-746c-4c1e-98f3-42ffe485be3b.zip, nsdestinationfilepath=/var/mobile/containers/data/application/e905fe5a-c39b-41f0-8bc7-fc58cc3f4306/documents/files/temp.zip, nsunderlyingerror=0x1457af70 "the operation couldn’t completed. no such file or directory"}

nsfilemanager *filemanager = [nsfilemanager defaultmanager]; nsarray *pathdocumentdirectory = nssearchpathfordirectoriesindomains(nsdocumentdirectory, nsuserdomainmask, yes); nsstring *dictionaryname = @"files"; nsstring *filespath = [[pathdocumentdirectory objectatindex:0] stringbyappendingpathcomponent:dictionaryname]; nsstring *topath = [filespath stringbyappendingpathcomponent:@"temp.zip"]; nsstring *frompath = downloadeditem.contenturl.path; nserror *error = nil; bool isdir = yes;  if([filemanager fileexistsatpath:frompath]) {     // create purchasedbooks directory     if (![filemanager fileexistsatpath:dictionaryname isdirectory:&isdir]) {         [filemanager createdirectoryatpath:dictionaryname withintermediatedirectories:no attributes:nil error:&error];     }     [[nsfilemanager defaultmanager]moveitematpath:frompath topath:topath error:&error];      if (error) {         nslog(@"error: %@", error.description);     } } 

really not understand why happens

add error checking for:

[filemanager createdirectoryatpath:dictionaryname withintermediatedirectories:no attributes:nil error:&error]; 

Comments

Popular posts from this blog

toolbar - How to add link to user registration inside toobar in admin joomla 3 custom component -

linux - disk space limitation when creating war file -

How to provide Authorization & Authentication using Asp.net, C#? -