我有这样的代码:
ALAssetsLibrary *library = [[ALAssetsLibrary alloc] init];
[library assetForURL:albumCopy
resultBlock:^(ALAsset *asset) {
NSLog(@"success");
...
}
failureBlock:^(NSError *error) {
NSLog(@"fail");
...
}];
[library autorelease];问题是,当我给它一个不存在的图像时,NSLog会产生:
找不到照片1000000141
成功
如果这张照片不存在的话,我怎么知道呢?
发布于 2011-08-27 15:21:05
解决了!
ALAssetsLibrary *library = [[ALAssetsLibrary alloc] init];
[library assetForURL:albumCopy
resultBlock:^(ALAsset *asset) {
if (asset == nil) {
//Image not in photo library
}
else {
//Image in photo library
}
}
failureBlock:^(NSError *error) {
//Error
}];
[library autorelease];https://stackoverflow.com/questions/7215021
复制相似问题