1
我正在將文件從服務器保存到ALAssetLibrary,以便用戶可以在離線模式下查看它如何在保存之前檢查文件(視頻)是否已存在於ALAssetsLibrary(相冊)中?
但是,我不希望用戶多次下載單個文件,以避免在相冊中創建重複項應用。
這是我的代碼:
ALAssetsLibrary* library = [[ALAssetsLibrary alloc] init];
void (^completionBlock)(NSURL *, NSError *) = ^(NSURL *assetURL, NSError *error)
{
if (error != nil)
{
//writeFailed = YES;
NSLog(@"error = %@", error);
}
//[self notifyCompletionTarget];
NSLog(@" saving is done");
};
NSURL *url = [[NSURL alloc] initFileURLWithPath:path];
[library writeVideoAtPathToSavedPhotosAlbum:url completionBlock:completionBlock ];
}
喜的情況下失敗, 你嘗試下面的方法? http://iphone.resourcezen.com/received-file-exists-in-photo-library 讓我知道,如果你找到解決方案。 – user130934 2012-03-22 13:50:17