iphone - saving in NSDocumentDirectory causing crash -
in app, camera roll
picked (single/multiple images). i'm saving images in nsdocumentdirectory
, here code that:
for (int = 0; < info.count; i++) { nslog(@"%@", [info objectatindex:i]); nsarray *paths = nssearchpathfordirectoriesindomains( nsdocumentdirectory, nsuserdomainmask ,yes ); nsstring *documentsdir = [paths objectatindex:0]; nsstring *savedimagepath = [documentsdir stringbyappendingpathcomponent:[nsstring stringwithformat:@"images%d.png", i]]; alassetrepresentation *rep = [[info objectatindex: i] defaultrepresentation]; uiimage *image = [uiimage imagewithcgimage:[rep fullresolutionimage]]; nsdata *imagedata = uiimagepngrepresentation(image); [imagedata writetofile:savedimagepath atomically:yes]; nslog(@"saving at:%@",savedimagepath); }
from that, working normally. when return again in camera roll save again (without restaring app) crashes(most of time) when testing in actual device or lags app. dunno if agimagepicker
library i'm using importing photo or way of saving it. way of saving in nsdocumentdirectory
wrong? or if there better way appreciated.
thanks...
try enabling zombie object , run
Comments
Post a Comment