0
更新/改寫問題:ALAssetsLibrary-CustomPhotoAlbum IOS 8
在項目中,我使用ALAssetsLibrary-CustomPhotoAlbum。雖然它在iOS 7上運行良好,但我從未注意到爲iOS 8編碼時,它終於被破壞了。不能重新創建使用相同名稱刪除的文件夾。
它會創建文件夾,如果它啓動作爲一個新的進程,如果你打開應用程序,它要求照片許可。
我當前的代碼仍然保存照片的文件夾說,如果我手動創建文件夾:
[self.library saveImage:image toAlbum:@"NamedAlbum" withCompletionBlock:^(NSError *error) {
if (error!=nil) {
NSLog(@"Big error: %@", [error description]);
}
}];
什麼我卡上是這樣的:
[self.library saveImage:image toAlbum:@"NamedAlbum" completion:nil failure:^(NSError *error) {
if (error!=nil) {
NSLog(@"Big error: %@", [error description]);
}
}];
看起來它改變了完成/失敗塊進程,我無法弄清楚。
我需要做什麼才能將這些鏈接到庫?
任何幫助,將不勝感激。
UPDATE 12/22 似乎我在發佈我的答案時超前了我自己,這隻有時纔有效。將繼續挖掘。
// The completion block to be executed after image taking action process done
void (^completion)(NSURL *, NSError *) = ^(NSURL *assetURL, NSError *error) {
if (error) NSLog(@"!!!ERROR, write the image data to the assets library (camera roll): %@",
[error description]);
NSLog(@"*** URL %@ | %@ || type: %@ ***", assetURL, image, [assetURL class]);
};
void (^failure)(NSError *) = ^(NSError *error) {
if (error == nil) return;
NSLog(@"!!!ERROR, failed to add the asset to the custom photo album: %@", [error description]);
};
[self.assetsLibrary saveImage:image
toAlbum:albumName
completion:completion
failure:failure];