Note that there are some explanatory texts on larger screens.

plurals
  1. POwriteImageToSavedPhotosAlbum too slow?
    primarykey
    data
    text
    <p>I'm developing an iPhone app that includes some standard "camera" functions. Saving to camera roll is really TOO slow, it requires about four seconds on iPhone 4. Is there some way to improve speed?</p> <p>If you look at the default iPhone Camera app, it can take subsequent photos without big delays, and photos are saved quite instantly to disk (if you click on the small square with the last photo taken, in the lower corner of the screen, the photo library always opens on the saved picture, even if you take a big sequence of them).</p> <p>Here's two snipplets of the significant code I use to get the image from the buffer and then to save the photo in the camera roll; I tried to put a NSLog before and after the 2nd snipplet, and it confirmed a 4 seconds delay to complete the the save process. </p> <pre><code>[stillImageOutput captureStillImageAsynchronouslyFromConnection:videoConnection completionHandler: ^(CMSampleBufferRef imageSampleBuffer, NSError *error) { NSData *imageData = [AVCaptureStillImageOutput jpegStillImageNSDataRepresentation:imageSampleBuffer]; UIImage *image = [[UIImage alloc] initWithData:imageData]; </code></pre> <p>...</p> <pre><code> ALAssetsLibrary *library = [[[ALAssetsLibrary alloc] init] autorelease]; NSLog(@"SCATTO: Inizio salvataggio in library..."); [library writeImageToSavedPhotosAlbum:[image CGImage] metadata:exifAttachments_dictionary completionBlock:^(NSURL *newURL, NSError *error) { if (error){ NSLog(@"SCATTO: Salvataggio in library: ERRORE"); } else { NSLog(@"SCATTO: Salvataggio in library: OK"); [self loadNewestPhoto]; } }]; </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload