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

enter image description here


Comments

Popular posts from this blog

javascript - backbone.js Collection.add() doesn't `construct` (`initialize`) an object -

php - Get uncommon values from two or more arrays -

Adding duplicate array rows in Php -