简体   繁体   中英

how to detect if image from photo library was taken by iPhone camera or imported

在我正在开发的应用程序中,我应该知道用户选择的图片最初是由iPhone的相机拍摄的,还是从任何其他来源拍摄的照片,如来自互联网或从外部相机等进口。

As @yoeriboven pointed out, you should check the image EXIF. The easiest way to access it would be:

ALAssetRepresentation *assetRep = [asset defaultRepresentation];
NSDictionary *metaData = [assetRep metadata];

This should be the relevant section:

"{TIFF}" = {
    DateTime = "2012:12:13 01:21:55";
    Make = Apple;
    Model = "iPhone 4";
    Orientation = 6;
    ResolutionUnit = 2;
    Software = "6.0.1";
    XResolution = 72;
    YResolution = 72;
    "_YCbCrPositioning" = 1;
};

I wouldn't count only on the location property. Non iPhone photos can have location as well.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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