objective c - Where to save the file in an application iPhon / iphone? -
i've make web app lot of image , safaris memory can't open of images. build application stores images in ipad. images can change dynamically , don't know can save it. rest of code works withe file put image.
notice : in ipad simulator works normally, in ipad have permission problem.
my code
uiimage *image = [[uiimage alloc] initwithdata:[nsdata datawithcontentsofurl:[nsurl urlwithstring: [nsstring stringwithformat:@"http://link_of_my_image", [splitlink objectatindex: 1],[splitlink objectatindex: 3] ] ]]]; nsdata *data1 = [nsdata datawithdata:uiimagepngrepresentation(image)]; bool test10 = [data1 writetofile:[nsstring stringwithformat: @"%@/%@/folder/%@",linkslidesfile, [splitlink objectatindex: 1],[splitlink objectatindex: 3]] atomically:yes]; nslog(@"creat image --------------------- %@ %i", [nsstring stringwithformat: @"%@/%@/folder/%@",[splitlink objectatindex: 0], [splitlink objectatindex: 1],[splitlink objectatindex: 3]], test10); log simulator :
creat image --------------------- link_of_image_ipad 1 log ipad :
creat image --------------------- link_of_image_ipad 0 can me please?
you able write documents directory; add method class in order path:
+ (nsstring *) applicationdocumentsdirectory { nsarray *paths = nssearchpathfordirectoriesindomains(nsdocumentdirectory, nsuserdomainmask, yes); nsstring *basepath = ([paths count] > 0) ? [paths objectatindex:0] : nil; return basepath; }
Comments
Post a Comment