Today, suddenly think of a friend circle to send photos, involving personal privacy is the location of the leak. Because the photos of the iphone will have geographical location and other information, we first to implement how to read the security information inside, and then to analyze
[OBJC] view plain copy
- #import "ViewController.h"
- #import <ImageIO/ImageIO.h>
- #import <AssetsLibrary/AssetsLibrary.h>
- @interface Viewcontroller () <UIImagePickerControllerDelegate,UINavigationControllerDelegate>
- @end
- @implementation Viewcontroller
- -(void) Viewdidload {
- [Super Viewdidload];
- //Create a Uiimagepickercontroller object
- Uiimagepickercontroller *ctrl = [[Uiimagepickercontroller alloc] init];
- //set type
- Ctrl. sourcetype = uiimagepickercontrollersourcetypephotolibrary;
- //Set up proxy
- Ctrl. Delegate = self ;
- //Display
- [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); Location information
- NSLog (@ "%@", imagemetadata);
- }
- failureblock:^ (nserror *error) {
- }];
- }
- }
IOS about image location Privacy Information analysis and Reading