2011-04-21 261 views
3

我正在研究一個應用程序,該應用程序涉及從使用iPhone的內置相機拍攝的照片中獲取信息。從照片中獲取詳細信息

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

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

我想獲取捕獲日期/時間以及捕獲位置的座標信息。任何想法我會如何做到這一點?

+1

這就是所謂的EXIF數據,這裏是一個相關的職位。 http://stackoverflow.com/questions/3673062/how-to-access-photo-exif-in-pictures-taken-from-camera-in-ios-4-0 – Joe 2011-04-21 13:02:52

回答

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"); 
    }];