【问题标题】:UIImagePickerController and extracting EXIF data from existing photosUIImagePickerController 并从现有照片中提取 EXIF 数据
【发布时间】:2010-11-17 08:28:02
【问题描述】:

众所周知,UIImagePickerController 在选择后不会返回照片的元数据。但是,应用商店中的一些应用(Mobile Fotos、PixelPipe)似乎能够读取原始文件和存储在其中的 EXIF 数据,从而使应用能够从所选照片中提取地理数据。

他们似乎是通过从 /private/var/mobile/Media/DCIM/100APPLE/ 文件夹中读取原始文件并通过 EXIF 库运行它来做到这一点的。

但是,我无法找到将 UIImagePickerController 返回的照片与磁盘上的文件进行匹配的方法。我研究了文件大小,但原始文件是 JPEG,而返回的图像是原始 UIImage,因此无法知道所选图像的文件大小。

我正在考虑制作一个哈希表并与每个图像的前 x 个像素进行匹配。不过,这似乎有点过头了,而且可能很慢。

有什么建议吗?

【问题讨论】:

  • 您是否同时找到了解决方案或替代方法?
  • 似乎大多数人寻求的解决方案是构建自己的表格视图以从照片列表中进行选择。 Mobile Fotos 似乎可以访问相机选择器,但我不知道如何。
  • 这个问题现在已经过时了,因为现在可以使用 AssetLibrary 框架在 iOS 4.0 下提取图像元数据。
  • 不,它仍然相关,因为您必须支持 3g 设备

标签: iphone cocoa-touch gps uiimagepickercontroller exif


【解决方案1】:

你看过这个 exif iPhone 库吗?

http://code.google.com/p/iphone-exif/

我会试试的。我想从使用 UIImagePickerController 拍摄的图片中获取 GPS(地理标签)坐标:/

经过深入研究,这个库似乎将 NSData 信息作为输入,并且 UIImagePickerController 在拍摄快照后返回 UIImage。理论上,如果我们使用从 UIkit 类别中选择的 UIImage

NSData * UIImageJPEGRepresentation (
   UIImage *image,
   CGFloat compressionQuality
);

然后我们可以将 UIImage 转换为 NSData 实例,然后与 iPhone exif 库一起使用。

更新:
我对上面提到的库进行了测试,它似乎有效。然而,由于我对 EXIF 格式的知识有限并且库中缺乏高级 API,我无法获得 EXIF 标记的值。 这是我的代码,以防你们中的任何人走得更远:


#import "EXFJpeg.h"

- (void)imagePickerController:(UIImagePickerController *)picker didFinishPickingImage:(UIImage *)image editingInfo:(NSDictionary *)editingInfo {
    NSLog(@"image picked %@ with info %@", image, editingInfo);
    NSData* jpegData = UIImageJPEGRepresentation (image,0.5);
    EXFJpeg* jpegScanner = [[EXFJpeg alloc] init];
    [jpegScanner scanImageData: jpegData];
    EXFMetaData* exifData = jpegScanner.exifMetaData;
    EXFJFIF* jfif = jpegScanner.jfif;
    EXFTag* tagDefinition = [exifData tagDefinition: [NSNumber numberWithInt:EXIF_DateTime]];
    //EXFTag* latitudeDef = [exifData tagDefinition: [NSNumber numberWithInt:EXIF_GPSLatitude]];
    //EXFTag* longitudeDef = [exifData tagDefinition: [NSNumber numberWithInt:EXIF_GPSLongitude]];
    id latitudeValue = [exifData tagValue:[NSNumber numberWithInt:EXIF_GPSLatitude]];
    id longitudeValue = [exifData tagValue:[NSNumber numberWithInt:EXIF_GPSLongitude]];
    id datetime = [exifData tagValue:[NSNumber numberWithInt:EXIF_DateTime]];
    id t = [exifData tagValue:[NSNumber numberWithInt:EXIF_Model]];
....
....

标签定义检索正常,但所有标签值都返回nil :(

如果您想尝试使用该库,则需要定义一个全局变量以使其运行(如文档中所述,但是嗯.. :/)

BOOL gLogging = FALSE;

更新 2
在这里回答:iPhone - access location information from a photo 一个 UIImage 没有封装元信息,所以我们被卡住了:当然,不会通过这个接口给出任何 EXIF 信息。

最终更新
好的,我设法让它工作,至少对选择器返回的图片进行正确的地理标记。
在触发 UIImagePickerController 之前,由您决定使用 CLLocationManager 来检索当前的 CLocation
拥有它后,您可以使用此方法使用 exif-iPhone 库对 CLLocation 中的 UIImage 进行地理标记:

-(NSData*) geotagImage:(UIImage*)image withLocation:(CLLocation*)imageLocation { NSData* jpegData = UIImageJPEGRepresentation(image, 0.8); EXFJpeg* jpegScanner = [[EXFJpeg alloc] init]; [jpegScanner scanImageData: jpegData]; EXFMetaData* exifMetaData = jpegScanner.exifMetaData; // end of helper methods // adding GPS data to the Exif object NSMutableArray* locArray = [self createLocArray:imageLocation.coordinate.latitude]; EXFGPSLoc* gpsLoc = [[EXFGPSLoc alloc] init]; [self populateGPS: gpsLoc :locArray]; [exifMetaData addTagValue:gpsLoc forKey:[NSNumber numberWithInt:EXIF_GPSLatitude] ]; [gpsLoc release]; [locArray release]; locArray = [self createLocArray:imageLocation.coordinate.longitude]; gpsLoc = [[EXFGPSLoc alloc] init]; [self populateGPS: gpsLoc :locArray]; [exifMetaData addTagValue:gpsLoc forKey:[NSNumber numberWithInt:EXIF_GPSLongitude] ]; [gpsLoc release]; [locArray release]; NSString* ref; if (imageLocation.coordinate.latitude <0.0) ref = @"S"; else ref =@"N"; [exifMetaData addTagValue: ref forKey:[NSNumber numberWithInt:EXIF_GPSLatitudeRef] ]; if (imageLocation.coordinate.longitude <0.0) ref = @"W"; else ref =@"E"; [exifMetaData addTagValue: ref forKey:[NSNumber numberWithInt:EXIF_GPSLongitudeRef] ]; NSMutableData* taggedJpegData = [[NSMutableData alloc] init]; [jpegScanner populateImageData:taggedJpegData]; [jpegScanner release]; return [taggedJpegData autorelease]; }

// Helper methods for location conversion -(NSMutableArray*) createLocArray:(double) val{ val = fabs(val); NSMutableArray* array = [[NSMutableArray alloc] init]; double deg = (int)val; [array addObject:[NSNumber numberWithDouble:deg]]; val = val - deg; val = val*60; double minutes = (int) val; [array addObject:[NSNumber numberWithDouble:minutes]]; val = val - minutes; val = val*60; double seconds = val; [array addObject:[NSNumber numberWithDouble:seconds]]; return array; } -(void) populateGPS:(EXFGPSLoc* ) gpsLoc :(NSArray*) locArray{ long numDenumArray[2]; long* arrPtr = numDenumArray; [EXFUtils convertRationalToFraction:&arrPtr :[locArray objectAtIndex:0]]; EXFraction* fract = [[EXFraction alloc] initWith:numDenumArray[0]:numDenumArray[1]]; gpsLoc.degrees = fract; [fract release]; [EXFUtils convertRationalToFraction:&arrPtr :[locArray objectAtIndex:1]]; fract = [[EXFraction alloc] initWith:numDenumArray[0] :numDenumArray[1]]; gpsLoc.minutes = fract; [fract release]; [EXFUtils convertRationalToFraction:&arrPtr :[locArray objectAtIndex:2]]; fract = [[EXFraction alloc] initWith:numDenumArray[0] :numDenumArray[1]]; gpsLoc.seconds = fract; [fract release]; }

【讨论】:

  • 是的,这就是我最初尝试的。但是感谢您的努力 - 如果您遇到其他方式,如果您在此处告诉我们,那就太好了。
  • 我将尝试使用 exif iphone 库自行对照片进行地理标记,我会及时通知您(从用户指南中看起来“简单”,但不是很直接...... :/)
  • 谢谢 yonel,但我实际上希望从相机应用程序拍摄的照片中获取 EXIF 信息。
  • 没有真正回答原来的问题!
  • 有人有这个库的 iOS5/ARC 版本吗?
【解决方案2】:

这适用于 iOS5(beta 4)和相机胶卷(您需要为 .h 中的块键入 defs):

-(void) imagePickerController:(UIImagePickerController *)picker 
           didFinishPickingMediaWithInfo:(NSDictionary *)info
{
  NSString *mediaType = [info objectForKey:UIImagePickerControllerMediaType];
  if ([mediaType isEqualToString:(NSString*)kUTTypeImage]) {
    NSURL *url = [info objectForKey:UIImagePickerControllerReferenceURL];
    if (url) {
      ALAssetsLibraryAssetForURLResultBlock resultblock = ^(ALAsset *myasset) {
      CLLocation *location = [myasset valueForProperty:ALAssetPropertyLocation];
      // location contains lat/long, timestamp, etc
      // extracting the image is more tricky and 5.x beta ALAssetRepresentation has bugs!
    };
    ALAssetsLibraryAccessFailureBlock failureblock = ^(NSError *myerror) {
      NSLog(@"cant get image - %@", [myerror localizedDescription]);
    };
    ALAssetsLibrary *assetsLib = [[ALAssetsLibrary alloc] init];
    [assetsLib assetForURL:url resultBlock:resultblock failureBlock:failureblock];
  }
}

【讨论】:

  • RonC 是对的。他的脚本允许您从从照片库中选择的图像中获取位置。 UIImagePickerController 不会给你相机的位置。您必须在应用程序中添加 CLLocationManager。发起/委托给自己。并调用“startUpdatingLocation”。然后在“-(void)locationManager:(CLLocationManager *)manager didUpdateToLocation:(CLLocation *)newLocation fromLocation:(CLLocation *)oldLocation”中,您可以从“newLocation”获取您的位置。现在如果你想把图片保存到照片库,你可以使用github.com/gpambrozio/GusUtils
  • 此解决方案非常适用于从相机胶卷拍摄的图像和视频!
【解决方案3】:

iOS 8有办法

使用任何第 3 方 EXIF 库。

#import <Photos/Photos.h>

- (void)imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary *)info {

    NSURL *url = [info objectForKey:UIImagePickerControllerReferenceURL];
    PHFetchResult *fetchResult = [PHAsset fetchAssetsWithALAssetURLs:@[url] options:nil];
    PHAsset *asset = fetchResult.firstObject;

    //All you need is
    //asset.location.coordinate.latitude
    //asset.location.coordinate.longitude

    //Other useful properties of PHAsset
    //asset.favorite
    //asset.modificationDate
    //asset.creationDate
}

【讨论】:

  • 这个方法总能得到当前的经纬度?
【解决方案4】:

Apple 在 iOS4 中添加了一个 Image I/O Framework,可用于从图片中读取 EXIF 数据。我不知道UIImagePickerController 是否返回嵌入了 EXIF 数据的图片。

编辑:在 iOS4 中,您可以通过获取传递给 UIImagePickerControllerDelegate 委托的信息字典中的 UIImagePickerControllerMediaMetadata 键的值来获取 EXIF 数据。

【讨论】:

  • 这是因为出于安全原因,必须删除所有位置信息。如果您想要位置信息,您必须使用上述库或 alassetslibrary,其中将提示用户允许启用本地化服务以获取位置信息。
  • 委托回调的信息字典中没有 UIImagePickerControllerMediaMetadata 这样的键。这是nil
  • "该键仅在使用源类型设置为 UIImagePickerController.SourceType.camera 的图像选择器时有效,并且仅适用于静止图像。" developer.apple.com/documentation/uikit/uiimagepickercontroller/…
【解决方案5】:

我有一个类似的问题,我只想要一张照片的拍摄日期,而上述方法似乎都不能以简单的方式解决我的问题(例如,没有外部库),所以这里是我能找到的所有数据您可以在使用选择器选择图像后从图像中提取:

// Inside whatever implements UIImagePickerControllerDelegate
@import AssetsLibrary;

// ... your other code here ...

@implementation MYImagePickerDelegate

- (void)imagePickerController:(UIImagePickerController *)picker
didFinishPickingMediaWithInfo:(NSDictionary *)info
{
    NSString *mediaType = info[UIImagePickerControllerMediaType];
    UIImage *originalImage = info[UIImagePickerControllerOriginalImage];
    UIImage *editedImage = info[UIImagePickerControllerEditedImage];
    NSValue *cropRect = info[UIImagePickerControllerCropRect];
    NSURL *mediaUrl = info[UIImagePickerControllerMediaURL];
    NSURL *referenceUrl = info[UIImagePickerControllerReferenceURL];
    NSDictionary *mediaMetadata = info[UIImagePickerControllerMediaMetadata];

    NSLog(@"mediaType=%@", mediaType);
    NSLog(@"originalImage=%@", originalImage);
    NSLog(@"editedImage=%@", editedImage);
    NSLog(@"cropRect=%@", cropRect);
    NSLog(@"mediaUrl=%@", mediaUrl);
    NSLog(@"referenceUrl=%@", referenceUrl);
    NSLog(@"mediaMetadata=%@", mediaMetadata);

    if (!referenceUrl) {
        NSLog(@"Media did not have reference URL.");
    } else {
        ALAssetsLibrary *assetsLib = [[ALAssetsLibrary alloc] init];
        [assetsLib assetForURL:referenceUrl
                   resultBlock:^(ALAsset *asset) {
                       NSString *type = 
                           [asset valueForProperty:ALAssetPropertyType];
                       CLLocation *location = 
                           [asset valueForProperty:ALAssetPropertyLocation];
                       NSNumber *duration = 
                           [asset valueForProperty:ALAssetPropertyDuration];
                       NSNumber *orientation = 
                           [asset valueForProperty:ALAssetPropertyOrientation];
                       NSDate *date = 
                           [asset valueForProperty:ALAssetPropertyDate];
                       NSArray *representations = 
                           [asset valueForProperty:ALAssetPropertyRepresentations];
                       NSDictionary *urls = 
                           [asset valueForProperty:ALAssetPropertyURLs];
                       NSURL *assetUrl = 
                           [asset valueForProperty:ALAssetPropertyAssetURL];

                       NSLog(@"type=%@", type);
                       NSLog(@"location=%@", location);
                       NSLog(@"duration=%@", duration);
                       NSLog(@"assetUrl=%@", assetUrl);
                       NSLog(@"orientation=%@", orientation);
                       NSLog(@"date=%@", date);
                       NSLog(@"representations=%@", representations);
                       NSLog(@"urls=%@", urls);
                   }
                  failureBlock:^(NSError *error) {
                      NSLog(@"Failed to get asset: %@", error);
                  }];
    }

    [picker dismissViewControllerAnimated:YES
                               completion:nil];
}

@end

因此,当您选择图像时,您会得到如下所示的输出(包括日期!):

mediaType=public.image
originalImage=<UIImage: 0x7fb38e00e870> size {1280, 850} orientation 0 scale 1.000000
editedImage=<UIImage: 0x7fb38e09e1e0> size {640, 424} orientation 0 scale 1.000000
cropRect=NSRect: {{0, 0}, {1280, 848}}
mediaUrl=(null)
referenceUrl=assets-library://asset/asset.JPG?id=AC072879-DA36-4A56-8A04-4D467C878877&ext=JPG
mediaMetadata=(null)
type=ALAssetTypePhoto
location=(null)
duration=ALErrorInvalidProperty
assetUrl=assets-library://asset/asset.JPG?id=AC072879-DA36-4A56-8A04-4D467C878877&ext=JPG
orientation=0
date=2014-07-14 04:28:18 +0000
representations=(
    "public.jpeg"
)
urls={
    "public.jpeg" = "assets-library://asset/asset.JPG?id=AC072879-DA36-4A56-8A04-4D467C878877&ext=JPG";
}

无论如何,希望这可以为其他人节省一些时间。

【讨论】:

    【解决方案6】:

    对于 iOS 8 及更高版本,您可以使用 Photos Framework.

     func imagePickerController(_ picker: UIImagePickerController, didFinishPickingMediaWithInfo info: [String : Any]) {
          let url = info[UIImagePickerControllerReferenceURL] as? URL
                if url != nil {
    
                    let fetchResult = PHAsset.fetchAssets(withALAssetURLs: [url!], options: nil)
                    let asset = fetchResult.firstObject
                    print(asset?.location?.coordinate.latitude)
                    print(asset?.creationDate)
                }
        }
    

    【讨论】:

      【解决方案7】:

      我也花了一些时间来处理这个我签约构建的应用程序。基本上,就目前的 API 而言,这是不可能的。基本问题是 UIImage 类删除了除方向外的所有 EXIF 数据。此外,保存到相机胶卷的功能会删除这些数据。因此,基本上获取和维护任何额外 EXIF 数据的唯一方法是将其保存在应用程序的私有“相机胶卷”中。我也向苹果提交了这个错误,并向我们接触过的应用审查代表强调了这一点。希望有一天他们会添加它。否则它会使 GEO 标记完全无用,因为它仅适用于“库存”相机应用程序。

      注意应用商店中的一些应用程序hack解决了这个问题。通过,我发现,直接访问相机胶卷并将照片直接保存到它以保存 GEO 数据。然而,这只适用于相机胶卷/保存的照片,而不适用于照片库的其余部分。从您的计算机“同步”到您手机的照片具有除方向剥离外的所有 EXIF 数据。

      我仍然不明白为什么这些申请被批准(他们甚至从相机胶卷中删除)而我们的申请仍然被阻止。

      【讨论】:

        【解决方案8】:

        这是公共 API 不提供的东西,但可能对许多人有用。您的主要资源是file a bug with Apple,它描述了您的需求(解释您为什么需要它也会有所帮助)。希望您的请求可以在未来的版本中发布。

        提交错误后,您还可以使用您的 iPhone 开发者计划会员资格附带的开发者技术支持 (DTS) 事件之一。如果有公开的方式来做到这一点,苹果工程师就会知道。否则,它至少可以帮助您在母舰中获得更多关注。祝你好运!

        【讨论】:

        • 谢谢 - 我刚刚提交了一个错误:#7388190。
        【解决方案9】:

        使用 UIImagePickerControllerMediaURL 字典键获取原始文件的文件 URL。不管文档怎么说,您都可以获得照片的文件 URL,而不仅仅是电影。

        - (void)imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary *)info {
        
            // Try to get the original file.
            NSURL *originalFile = [info objectForKey:UIImagePickerControllerMediaURL];
            if (originalFile) {
                NSData *fileData = [NSData dataWithContentsOfURL:originalFile];
            }
        }
        

        【讨论】:

        • 在 4.2 中似乎不存在
        【解决方案10】:

        您也许可以对 UIImagePickerController 返回的图像数据和目录中的每个图像进行哈希处理并进行比较。

        【讨论】:

        • 这是一个有趣的想法 - 你知道它是否有效,速度如何?
        • 不知道它是否有效,只是一种尝试的方法。如果它有效但性能不佳,您可以将文件名和哈希值缓存在 plist 中,这样您只需为现有图像计算一次。
        【解决方案11】:

        只是一个想法,但你在 GitHub 上的 Three20 项目中尝试过 TTPhotoViewController 吗?

        这提供了一个可以从多个来源读取的图像选择器。您也许可以将它用作 UIImagePickerController 的替代品,或者源代码可能会为您提供如何计算如何获取所需信息的线索。

        【讨论】:

        • 这可行,但您仍然需要从 /private/var/mobile/Media/DCIM/100APPLE/ 中读取图像 - 它所做的只是在此之上提供更好的用户界面.
        • tomtaylor:不要指望 Apple 会批准直接从该文件夹读取的应用程序
        【解决方案12】:

        您是否有特定原因要从图像中提取位置数据?另一种方法是使用 CoreLocation 框架单独获取位置。如果它只是您需要的地理数据,这可能会为您省去一些麻烦。

        【讨论】:

        • 这就是 flickr 应用程序所做的事情,实际上它非常令人困惑:上传您在家中拍摄的照片时,它会显示您当前的位置,而不是照片的拍摄地点。 ..
        • 是的,这就是我要避免的。我还想要 EXIF 标头中的 DateTakenOriginal。
        【解决方案13】:

        UIImagePickerControllerMediaURL 获得的照片似乎根本没有 exif 标签

        【讨论】:

          【解决方案14】:

          为了获取此元数据,您必须使用较低级别的框架 AVFoundation。

          看看 Apple 的 Squarecam 示例 (http://developer.apple.com/library/ios/#samplecode/SquareCam/Introduction/Intro.html)

          找到下面的方法并添加行,我已经添加到代码中。返回的元数据字典还包含一个诊断 NSDictionary 对象。

          - (BOOL)writeCGImageToCameraRoll:(CGImageRef)cgImage withMetadata:(NSDictionary *)metadata
          {
          
             NSDictionary *Exif = [metadata objectForKey:@"Exif"];   // Add this line
          
          }
          

          【讨论】:

            【解决方案15】:

            我正在使用它来拍摄相机胶卷图像

            -(CLLocation*)locationFromAsset:(ALAsset*)asset
            {
                if (!asset)
                    return nil;
            
                NSDictionary* pickedImageMetadata = [[asset defaultRepresentation] metadata];
                NSDictionary* gpsInfo = [pickedImageMetadata objectForKey:(__bridge NSString *)kCGImagePropertyGPSDictionary];
                if (gpsInfo){
                    NSNumber* nLat = [gpsInfo objectForKey:(__bridge NSString *)kCGImagePropertyGPSLatitude];
                    NSNumber* nLng = [gpsInfo objectForKey:(__bridge NSString *)kCGImagePropertyGPSLongitude];
                    if (nLat && nLng)
                        return [[CLLocation alloc]initWithLatitude:[nLat doubleValue] longitude:[nLng doubleValue]];
                }
            
                return nil;
            }
            
            
            -(void) imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary *)info
            {
                //UIImage *image =  [info objectForKey:UIImagePickerControllerOriginalImage];
                NSURL *assetURL = [info objectForKey:UIImagePickerControllerReferenceURL];
            
                // create the asset library in the init method of your custom object or view controller
                //self.library = [[ALAssetsLibrary alloc] init];
                //
            
                [self.library assetForURL:assetURL resultBlock:^(ALAsset *asset) {
            
                    // try to retrieve gps metadata coordinates
                    CLLocation* myLocation = [self locationFromAsset:asset];
            
                    // Do your stuff....
            
                } failureBlock:^(NSError *error) {
                    NSLog(@"Failed to get asset from library");
                }];
            }
            

            如果图像包含 gps 元信息,它显然可以工作

            希望对你有帮助

            【讨论】:

              【解决方案16】:

              如果您仍希望支持 iOS 8,这在 Swift 3 中:

              import AssetsLibrary
              
              func imagePickerController(_ picker: UIImagePickerController, didFinishPickingMediaWithInfo info: [String : Any]) {
              
                  if picker.sourceType == UIImagePickerControllerSourceType.photoLibrary,
                      let url = info[UIImagePickerControllerReferenceURL] as? URL {
              
                      let assetLibrary = ALAssetsLibrary()
                      assetLibrary.asset(for: url, resultBlock: { (asset) in
                          if let asset = asset {
                              let assetRep: ALAssetRepresentation = asset.defaultRepresentation()
                              let metaData: NSDictionary = assetRep.metadata() as NSDictionary
                              print(metaData)
                          }
                      }, failureBlock: { (error) in
                          print(error!)
                      })
                  }
              
              }
              

              【讨论】:

              【解决方案17】:

              适用于 iOS 10 - Swift 3

              选择器的回调有一个info dict,其中有一个带有metadata 的键:UIImagePickerControllerMediaMetadata

              【讨论】:

              • 这(从 iOS 12 开始)仅在媒体项是新捕获的情况下才成立,而不是从照片库中选择。
              【解决方案18】:

              这样做的调皮方法是遍历 UIImagePickerViewController 的视图,并在委托回调中挑选出选定的图像。

              - (void)imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary *)info {
              
                id thumbnailView = [[[[[[[[[[picker.view subviews] 
                                objectAtIndex:0] subviews]
                                objectAtIndex:0] subviews]
                              objectAtIndex:0] subviews]
                              objectAtIndex:0] subviews]
                            objectAtIndex:0];
              
                NSString *fullSizePath = [[[thumbnailView selectedPhoto] fileGroup] pathForFullSizeImage];
                NSString *thumbnailPath = [[[thumbnailView selectedPhoto] fileGroup] pathForThumbnailFile];
              
                NSLog(@"%@ and %@", fullSizePath, thumbnailPath);
              
              }
              

              这将为您提供完整尺寸图像的路径,然后您可以使用您选择的 EXIF 库打开该图像。

              但是,这会调用私有 API,如果您提交此应用程序,Apple 将检测到这些方法名称​​。所以不要这样做,好吗?

              【讨论】:

              • 如果我可以两次投反对票,我会的,不仅是淘气,它可能在当前版本的 iOS 中被冲洗掉了。切勿遍历不属于您的视图的视图层次结构。
              • 这就是我所说的。虽然你是对的,它已经过时了,但回答它的时间是唯一的方法。
              猜你喜欢
              • 1970-01-01
              • 2019-06-13
              • 1970-01-01
              • 1970-01-01
              • 2012-04-03
              • 1970-01-01
              • 2012-06-18
              • 1970-01-01
              • 2018-03-10
              相关资源
              最近更新 更多