ios - save picture in folder which is located in document direcotory in iphone -


i want create folder in document directory , want save images in folder. have tried folder , images storing in document directory..but want store images inside folder.my code working fine images not saving inside folder..

nserror *error; nsstring *adocumentsdirectory = [nssearchpathfordirectoriesindomains(nsdocumentdirectory, nsuserdomainmask, yes) lastobject]; nsstring *datapath = [adocumentsdirectory stringbyappendingpathcomponent:@"folder"]; [[nsfilemanager defaultmanager] createdirectoryatpath:datapath withintermediatedirectories:no attributes:nil error:&error];  nsinteger anindex = 0;  (uiimage *animage in _chosenimages)  {  nsstring *animagename = [nsstring stringwithformat:@"%d.png", anindex++]; nsstring *animagepath = [nsstring stringwithformat:@"%@/%@", adocumentsdirectory, animagename]; nslog(@"the path is=%@",animagepath);  nsdata *animagedata = uiimagepngrepresentation(animage); [animagedata writetofile:animagepath atomically:yes]; } 

i guess "animagepath" still pointing documents directory. edit "datapath" argument below

nsstring *animagepath = [nsstring stringwithformat:@"%@/%@", datapath, animagename]; 

Comments

Popular posts from this blog

php - Calling a template part from a post -

Firefox SVG shape not printing when it has stroke -

How to mention the localhost in android -