-1

这是我尝试编译项目时遇到的错误:

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

调用时出现错误writeImageToSavedPhotosAlbum。我怀疑错误与未导入必要的框架有关,但我不知道要导入什么。

有什么帮助吗?


编辑

这是我的writeImageToSavedPhotosAlbum代码:

- (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:));
}

编辑#2 我在我的 .m 文件中包含了以下导入:

#import <AssetsLibrary/AssetsLibrary.h>
4

1 回答 1

3

writeImageToSavedPhotosAlbum是一种方法ALAssetsLibrary,你必须做类似的事情

ALAssetsLibrary *library = [[ALAssetsLibrary alloc] init];
[library writeImageToSavedPhotosAlbum:[image CGImage] orientation:(ALAssetOrientation)[image imageOrientation] completionBlock:your_completion_block];
于 2012-08-02T08:22:14.987 回答