alex
alex

Reputation: 21

Write UIImage to Saved photo albums with EXIF

I encounter the following problem when using UIImageWriteToSavedPhotoAlbum and the EXIF data is lost.

UIImage * image = [[UIImage alloc] initWithData:recevedData];
UIImageWriteToSavedPhotosAlbum (image, self, @selector(myselector:), nil);

receivedData is a complete JPG file received remotely. The JPG file has all the Exif information inside. However after using UIImageWriteToSavedPhotosAlbum to save to photo albums I realize there is no more EXIF stored. Is this because of UIImageWriteToSavedPhotosAlbum or because of UIImage stripping of all the EXIF?

Upvotes: 1

Views: 1480

Answers (2)

SashaQbl
SashaQbl

Reputation: 3364

See assets library framework to save images with EXIF-data.

Upvotes: 2

user745098
user745098

Reputation:

UIImageWriteToSavedPhotosAlbum(image, self, @selector(image:didFinishSavingWithError:contextInfo:) , nil);

- (void) image:(UIImage *) image didFinishSavingWithError:(NSError *) error contextInfo:(void *) contextInfo {
    if ([image isEqual:image]) {
        if (error) {
            // Handle the error...
        }else {
            // saved succesfully
        }
    }else if (image == nil) {
        // no image was provided
    }
}

Apple documentation recommends above format for the selector. It may be not solve your problem, but you will know whats happening.

Upvotes: 0

Related Questions