How to access images stored in Documents Directory in ios8 -
How to access images stored in Documents Directory in ios8 -
in ios7 can write images documents directory , access without problem. in ios8 able write imagesdata documents directory , access it. location of images folder changes every time run app on simulator.i went through many stack overflow questions , apple's technical note (link:https://developer.apple.com/library/ios/technotes/tn2406/_index.html) didn't solution.actually storing path of images file in sqlite database.
any help appreciated.
seems storing finish path.
in ios 8 apple changed directory structure.apple extended folders in documents directory internally(i.e /developer/data/some random number sequence).directory folders keeps on changing on every build,if u store finish path in sqlite not find file @ location because documents directory location has changed.
the solution not store finish path store path documents directory database,while accessing images prefix current application documents directory, able access images apps directory
example:
//storing images nsstring *imagepathstring = [nsstring stringwithformat:@“/%@/%@.png”,@“your folder name”,@“image name”]; //store image path string database //retrieving images nsarray *paths = nssearchpathfordirectoriesindomains(nsdocumentdirectory, nsuserdomainmask, yes); nsstring *documentspath = [paths objectatindex:0]; nsstring *filepath = [documentspath stringbyappendingpathcomponent:imagepathstring]; //this path images
directory ios8 xcode6 documentsdirectory
Comments
Post a Comment