第七色在线视频,2021少妇久久久久久久久久,亚洲欧洲精品成人久久av18,亚洲国产精品特色大片观看完整版,孙宇晨将参加特朗普的晚宴

為了賬號(hào)安全,請(qǐng)及時(shí)綁定郵箱和手機(jī)立即綁定
已解決430363個(gè)問(wèn)題,去搜搜看,總會(huì)有你想問(wèn)的

UIImagePickerController并從現(xiàn)有照片中提取EXIF數(shù)據(jù)

UIImagePickerController并從現(xiàn)有照片中提取EXIF數(shù)據(jù)

iOS
Qyouu 2019-07-24 10:28:31
UIImagePickerController并從現(xiàn)有照片中提取EXIF數(shù)據(jù)眾所周知,UIImagePickerController在選擇后不會(huì)返回照片的元數(shù)據(jù)。但是,應(yīng)用程序商店中的一些應(yīng)用程序(Mobile Fotos,PixelPipe)似乎能夠讀取原始文件和存儲(chǔ)在其中的EXIF數(shù)據(jù),使應(yīng)用程序能夠從所選照片中提取地理數(shù)據(jù)。他們似乎是通過(guò)從/ private / var / mobile / Media / DCIM / 100APPLE /文件夾中讀取原始文件并通過(guò)EXIF庫(kù)運(yùn)行它來(lái)完成此操作。但是,我無(wú)法找到一種方法來(lái)匹配從UIImagePickerController返回的照片到磁盤(pán)上的文件。我已經(jīng)探索了文件大小,但原始文件是JPEG,而返回的圖像是原始UIImage,因此無(wú)法知道所選圖像的文件大小。我正在考慮制作一個(gè)哈希表并匹配每個(gè)圖像的前x個(gè)像素。雖然這看起來(lái)有點(diǎn)過(guò)頭了,但可能很慢。有什么建議?
查看完整描述

3 回答

?
收到一只叮咚

TA貢獻(xiàn)1821條經(jīng)驗(yàn) 獲得超5個(gè)贊

這適用于iOS5(beta 4)和相機(jī)膠卷(你需要為.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];
  }}


查看完整回答
反對(duì) 回復(fù) 2019-07-24
?
有只小跳蛙

TA貢獻(xiàn)1824條經(jīng)驗(yàn) 獲得超8個(gè)贊

有一種方法 iOS 8

使用任何第三方EXIF庫(kù)。

#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}


查看完整回答
反對(duì) 回復(fù) 2019-07-24
  • 3 回答
  • 0 關(guān)注
  • 696 瀏覽

添加回答

舉報(bào)

0/150
提交
取消
微信客服

購(gòu)課補(bǔ)貼
聯(lián)系客服咨詢(xún)優(yōu)惠詳情

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動(dòng)學(xué)習(xí)伙伴

公眾號(hào)

掃描二維碼
關(guān)注慕課網(wǎng)微信公眾號(hào)