Photo taken with camera does not contain any ALAsset metadata

后端 未结 2 487
太阳男子
太阳男子 2020-12-30 11:24

The weirdest thing is happening. I have an action sheet which gives the user the choice to either take a photo with the camera or choose one from the camera roll. Upon the U

相关标签:
2条回答
  • 2020-12-30 11:58

    In - (void)imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary *)info

    Try this when saving the Photo

        ALAssetsLibrary *library = [[ALAssetsLibrary alloc] init];
        [library writeImageToSavedPhotosAlbum:image.CGImage
                                     metadata:[info objectForKey:UIImagePickerControllerMediaMetadata]
                              completionBlock:^(NSURL *assetURL, NSError *error) {
            NSLog(@"assetURL %@", assetURL);
        }];
    
    0 讨论(0)
  • 2020-12-30 12:07

    @Thanh-Cong Vo is right about how to save the image to Photo Album. And See what say the Apples documents about saving image to photo album

    To save a still image to the user’s Camera Roll album, call the UIImageWriteToSavedPhotosAlbum function from within the body of the imagePickerController:didFinishPickingMediaWithInfo: method. To save a movie to the user’s Camera Roll album, instead call the UISaveVideoAtPathToSavedPhotosAlbum function. These functions, described in UIKit Function Reference, save the image or movie only; they do not save metadata.

    Starting in iOS 4.0, you can save still-image metadata, along with a still image, to the Camera Roll. To do this, use the writeImageToSavedPhotosAlbum:metadata:completionBlock: method of the Assets Library framework. See the description for the UIImagePickerControllerMediaMetadata key.

    0 讨论(0)
提交回复
热议问题