This should work:
CFDataRef imgData; CGDataProviderRef imgDataProvider; CGImageRef image1; imgData = (CFDataRef)[array objectAtIndex:i]; imgDataProvider = CGDataProviderCreateWithCFData (imgData); CFRelease(imgData); image1 = CGImageCreateWithPNGDataProvider(imgDataProvider, NULL, true, kCGRenderingIntentDefault); CGDataProviderRelease(imgDataProvider);
Remember to use CGImageRelease(image1);
after you finish with it.
source share