【问题标题】:How to Get Photos Info From photo library iphone?如何从照片库 iphone 获取照片信息?
【发布时间】:2011-11-08 16:00:56
【问题描述】:

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

【问题讨论】:

    标签: iphone photo


    【解决方案1】:

    您需要使用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];
    

    【讨论】:

    • 感谢 Srikar 的帮助,我可以获取有关照片的信息,但元数据中没有时间信息。它没有显示任何时间信息,例如保存时间。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2010-10-11
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多