cocoa touch - Crash when calling CGImageDestinationFinalize with large photo -


in code below crashing on cgimagedestinationfinalize() line. cgimage large jpg photo. works fine if use smaller jpg. on 10mb crashes on device "out of memory".

i think cgimagedestination* methods streaming write must doing wrong retaining data.

is there api call should use when writing large jpgs?

bool skimagewritetodisk(cgimageref image, nsurl *url, skimageprofile profile, cgfloat dpi) {     cfstringref type = profile == skmageprofilecompressed ? kuttypejpeg : kuttypepng;     cgimagedestinationref destination = cgimagedestinationcreatewithurl((__bridge cfurlref)url, type, 1, null);     if (!destination) {         return no;     }      nsmutabledictionary *properties =     [@{         (id) kcgimagepropertydpiheight: @(dpi),         (id) kcgimagepropertydpiwidth: @(dpi)     } mutablecopy];     if (profile == skimageprofilecompressed) {         properties[(id) kcgimagedestinationlossycompressionquality] = @(0.8f);     }     cgimagedestinationaddimage(destination, image, (__bridge cfdictionaryref)properties);     bool finalizesuccess = cgimagedestinationfinalize(destination); // crash!     cfrelease(destination);     return finalizesuccess; } 


Comments

Popular posts from this blog

user interface - Python attempting to create a simple gui, getting "AttributeError: 'MainMenu' object has no attribute 'intro_screen'" -

jquery - Common JavaScript snippet to share files on Google Drive, Dropbox, Box.net or SkyDrive -

Android Gson.fromJson error -