iOS 關於圖片地理位置隱私資訊的分析和讀取

來源:互聯網
上載者:User

標籤:讀取   nil   class   nsstring   meta   one   ctf   picker   control   

今天突然想到朋友圈發照片,涉及個人隱私的地理位置是否外泄。由於iphone拍照的照片都會帶有地理位置等資訊。我們先來實現怎麼讀取裡面的安全資訊。然後再來分析

#import "ViewController.h"#import <ImageIO/ImageIO.h>#import <AssetsLibrary/AssetsLibrary.h>@interface ViewController ()<UIImagePickerControllerDelegate,UINavigationControllerDelegate>@end@implementation ViewController- (void)viewDidLoad {    [super viewDidLoad];           //建立一個UIImagePickerController對象    UIImagePickerController *ctrl = [[UIImagePickerController alloc] init];    //設定類型    ctrl.sourceType = UIImagePickerControllerSourceTypePhotoLibrary;    //設定代理    ctrl.delegate = self;        //顯示    [self presentViewController:ctrl animated:YES completion:nil];            }-(void)imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary *)info{            if(picker.sourceType == UIImagePickerControllerSourceTypePhotoLibrary){        //UIImage *image= [info objectForKey:UIImagePickerControllerOriginalImage];                NSURL *assetURL = [info objectForKey:UIImagePickerControllerReferenceURL];                ALAssetsLibrary *library = [[ALAssetsLibrary alloc] init];        [library assetForURL:assetURL                 resultBlock:^(ALAsset *asset) {                     NSDictionary* imageMetadata = [[NSMutableDictionary alloc] initWithDictionary:asset.defaultRepresentation.metadata];                                          NSDictionary *GPS = [imageMetadata objectForKey:(NSString *)kCGImagePropertyGPSDictionary];                     NSLog(@"--------%@",GPS);//地理位置資訊                     NSLog(@"%@",imageMetadata);                                      }                 failureBlock:^(NSError *error) {                 }];     }        }




經過我的調查:

首先朋友假設用。原圖形式發給你的照片。是帶有地理位置資訊的。你先儲存到相冊,然後利用上面的代碼試試看。

假設不是原圖形式的。那麼這些安全資訊都會被抹去。

所以一般發到朋友圈,微博這些社交平台上。

照片不是原圖形式,地理位置這些安全資訊是看不到的。能夠放心使用。

我不知道能不能通過某種方法讀取的不是原圖形式的照片安全資訊。假設會的朋友請告訴我噢。。。

iOS 關於圖片地理位置隱私資訊的分析和讀取

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.