繁体   English   中英

如何从照片库iPhone获取照片信息?

[英]How to Get Photos Info From photo library iphone?

是否有可能在照片库中获取完整的照片信息,例如保存日期和时间。我发现我们可以使用断言库从照片库中获取所有照片,是否有任何类可以获取照片的完整信息。

您需要使用Assets库和UIImagePickerController 我将一些代码作为采样器。

NSMutableDictionary *imageMetadata = nil;
NSURL *assetURL = [info objectForKey:UIImagePickerControllerReferenceURL];

ALAssetsLibrary *library = [[ALAssetsLibrary alloc] init];
[library assetForURL:assetURL
    resultBlock:^(ALAsset *asset)  {
        NSDictionary *metadata = asset.defaultRepresentation.metadata;
        imageMetadata          = [[NSMutableDictionary alloc] initWithDictionary:metadata];
        [self addEntriesFromDictionary:metadata];
    }
    failureBlock:^(NSError *error) {
    }];
[library autorelease];

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM