2012-08-02 32 views
-1

時,這是我的錯誤,當我嘗試編譯我的項目:iOS的錯誤使用writeImageToSavedPhotosAlbum

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> 
+0

顯示你的代碼中調用'writeImageToSavedPhotosAlbum'。 – 2012-08-02 08:14:29

+0

看到我的編輯,謝謝:-) – 2012-08-02 08:17:12

+0

在問你有人建議你使用'writeImageToSavedPhotosAlbum'的問題,他們提供了一個鏈接到[文檔](https://developer.apple.com/library/ ios /#documentation/AssetsLibrary/Reference/ALAssetsLibrary_Class/Reference/Reference.html#// apple_ref/occ/instm/ALAssetsLibrary/writeImageToSavedPhotosAlbum:metadata:completionBlock :)它告訴你需要包含哪些框架 – 2012-08-02 08:18:18

回答

3

writeImageToSavedPhotosAlbumALAssetsLibrary的方法,你必須這樣做

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

感謝martin,儘管我仍然需要包含AssetsLibrary框架,但我現在已經完成了:) – 2012-08-02 08:31:02