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

python - How to create a legend for 3D bar in matplotlib? -

java - Multi-Label Document Classification -

php - Dynamic url re-writing using htaccess -