简体   繁体   中英

iOS error when using writeImageToSavedPhotosAlbum

This is the error I get when I try and compile my project:

Undefined symbols for architecture armv7:
  "_writeImageToSavedPhotosAlbum", referenced from:
  -[AddNewPhotoViewController imagePickerController:didFinishPickingMediaWithInfo:] in AddNewPhotoViewController.o

I get the error when calling writeImageToSavedPhotosAlbum . I suspect the error is to do with not importing the necessary frameworks, but I don't know what to import.

Any help?


EDIT

Here's my writeImageToSavedPhotosAlbum code:

- (void) imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary *)info
{
    // Access the uncropped image from info dictionary
    UIImage *image = [info objectForKey:@"UIImagePickerControllerOriginalImage"];

    [self dismissModalViewControllerAnimated:YES];

    [_CameraOutput setImage:image];

    writeImageToSavedPhotosAlbum(image, nil, @selector(image:didFinishSavingWithError:contextInfo:));
}

EDIT #2 I had included the following import in my .m file:

#import <AssetsLibrary/AssetsLibrary.h>

writeImageToSavedPhotosAlbum is a method of ALAssetsLibrary , you must do something like

ALAssetsLibrary *library = [[ALAssetsLibrary alloc] init];
[library writeImageToSavedPhotosAlbum:[image CGImage] orientation:(ALAssetOrientation)[image imageOrientation] completionBlock:your_completion_block];

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM