我想出了如何使用AssestsLibrary在相机胶卷中获取所有用户的图像:
- (void)updateLastPhotoThumbnail {
ALAssetsLibrary *assetsLibrary = [[ALAssetsLibrary alloc] init];
[assetsLibrary enumerateGroupsWithTypes:ALAssetsGroupSavedPhotos usingBlock:^(ALAssetsGroup *group, BOOL *stop) {
NSInteger numberOfAssets = [group numberOfAssets];
if (numberOfAssets > 0) {
NSLog(@"numberOfPictures: %d",numberOfAssets);
//NSInteger lastIndex = numberOfAssets - 1;
int i = 0;
for (i = 0; i <= numberOfAssets-1; i++) {
[group enumerateAssetsAtIndexes:[NSIndexSet indexSetWithIndex:i] options:0 usingBlock:^(ALAsset *result, NSUInteger index, BOOL *stop) {
UIImage *thumbnail = [UIImage imageWithCGImage:[result thumbnail]];
NSLog(@"theObject!!!! -- (%d) %@",i,thumbnail);
[cameraRollPictures addObject:thumbnail];
}];
}
}
} failureBlock:^(NSError *error) {
NSLog(@"error: %@", error);
}];
}
我成功创建了UIIMages数组,但是如何使用此片段从UIImages获取EXIF数据?
PS:我已经看过这个http://code.google.com/p/iphone-exif了,但我无法在没有错误的情况下进行构建。
答案 0 :(得分:2)
您无法从UIImage对象获取元数据。 但您可以在ALasset对象中查询元数据:
NSDictionary *metadata = [[result defaultRepresentation] metadata];
厨师,
亨德里克