从照片获取细节

时间:2011-04-21 12:52:00

标签: iphone cocoa-touch ios camera

我正在开发一款应用程序,该应用程序涉及从使用iPhone内置相机拍摄的照片中获取信息。

UIImagePickerController * picker = [[UIImagePickerController alloc] init];
    picker.delegate = self;

picker.sourceType = UIImagePickerControllerSourceTypeCamera;
[self presentModalViewController:picker animated:YES];

我想了解捕获日期/时间的信息以及捕获地点的坐标。知道怎么做吗?

1 个答案:

答案 0 :(得分:0)

使用资产框架,您可以这样做:

  #import <AssetsLibrary/AssetsLibrary.h>

  ALAssetsLibrary *library = [[ALAssetsLibrary alloc] init];
  NSURL *url = [info objectForKey:UIImagePickerControllerReferenceURL];

  [library assetForURL:url resultBlock:^(ALAsset *asset) {
    NSLog(@"TIMESTAMP: %@", [asset valueForProperty:ALAssetPropertyDate]);
  } failureBlock:^(NSError *error) {
      NSLog(@"FAIL");
  }];