我找到了使用AssestsLibrary获取用户相机胶卷中所有图片的方法:
PS:我已经查看了http://code.google.com/p/iphone-exif,但是我无法成功构建它,总是出现错误。
- (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);
}];
}
我已经成功创建了UIImage数组,但是如何使用我现有的代码片段从这些UIImage中获取EXIF数据呢?PS:我已经查看了http://code.google.com/p/iphone-exif,但是我无法成功构建它,总是出现错误。