標籤:讀取 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 關於圖片地理位置隱私資訊的分析和讀取