今天突然想到微信朋友圈发照片,涉及个人隐私的地理位置是否外泄。因为iphone拍照的照片都会带有地理位置等信息,我们先来实现怎么读取里面的安全信息,然后再来分析
- #import "ViewController.h"
- #import <ImageIO/ImageIO.h>
- #import <AssetsLibrary/AssetsLibrary.h>
- @interface ViewController ()<UIImagePickerControllerDelegate,UINavigationControllerDelegate>
-
- @end
-
- @implementation ViewController
-
- - (void)viewDidLoad {
- [super viewDidLoad];
-
-
-
- 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){
-
-
- 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 关于图片地理位置隐私信息的分析和读取
原文:http://www.cnblogs.com/LiLihongqiang/p/5592713.html