zoukankan      html  css  js  c++  java
  • iOS 关于图片地理位置隐私信息的分析和读取

    今天突然想到微信朋友圈发照片,涉及个人隐私的地理位置是否外泄。因为iphone拍照的照片都会带有地理位置等信息,我们先来实现怎么读取里面的安全信息,然后再来分析

     

    [objc] view plain copy
     
    1. #import "ViewController.h"  
    2. #import <ImageIO/ImageIO.h>  
    3. #import <AssetsLibrary/AssetsLibrary.h>  
    4. @interface ViewController ()<UIImagePickerControllerDelegate,UINavigationControllerDelegate>  
    5.   
    6. @end  
    7.   
    8. @implementation ViewController  
    9.   
    10. - (void)viewDidLoad {  
    11.     [super viewDidLoad];  
    12.      
    13.       
    14.     //创建一个UIImagePickerController对象  
    15.     UIImagePickerController *ctrl = [[UIImagePickerController alloc] init];  
    16.     //设置类型  
    17.     ctrl.sourceType = UIImagePickerControllerSourceTypePhotoLibrary;  
    18.     //设置代理  
    19.     ctrl.delegate = self;  
    20.       
    21.     //显示  
    22.     [self presentViewController:ctrl animated:YES completion:nil];  
    23.       
    24.   
    25.       
    26.       
    27. }  
    28.   
    29. -(void)imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary *)info  
    30. {  
    31.   
    32.       
    33.       
    34.     if(picker.sourceType == UIImagePickerControllerSourceTypePhotoLibrary){  
    35.         //UIImage *image= [info objectForKey:UIImagePickerControllerOriginalImage];  
    36.           
    37.         NSURL *assetURL = [info objectForKey:UIImagePickerControllerReferenceURL];  
    38.           
    39.         ALAssetsLibrary *library = [[ALAssetsLibrary alloc] init];  
    40.         [library assetForURL:assetURL  
    41.                  resultBlock:^(ALAsset *asset) {  
    42.                      NSDictionary* imageMetadata = [[NSMutableDictionary alloc] initWithDictionary:asset.defaultRepresentation.metadata];  
    43.   
    44.                        
    45.                      NSDictionary *GPS = [imageMetadata objectForKey:(NSString *)kCGImagePropertyGPSDictionary];  
    46.                      NSLog(@"--------%@",GPS);//地理位置信息  
    47.                      NSLog(@"%@",imageMetadata);   
    48.                       
    49.                  }   
    50.                 failureBlock:^(NSError *error) {   
    51.                 }];   
    52.     }  
    53.       
    54.       
    55. }  


     

  • 相关阅读:
    数据类型补充
    Kubernetes1.18.5 Cilium安装
    Cilium安装要求
    CentOS内核升级
    临时存储 Ephemeral Storage
    Pod优先级
    kubelet 垃圾回收策略
    Kubernetes Eviction驱逐
    根据PID查看具体的容器
    Kubernetes 资源预留(二)
  • 原文地址:https://www.cnblogs.com/LiLihongqiang/p/5592713.html
Copyright © 2011-2022 走看看