IOS about image location Privacy Information analysis and Reading

Source: Internet
Author: User

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  
  1. #import "ViewController.h"
  2. #import <ImageIO/ImageIO.h>
  3. #import <AssetsLibrary/AssetsLibrary.h>
  4. @interface Viewcontroller () <UIImagePickerControllerDelegate,UINavigationControllerDelegate>
  5. @end
  6. @implementation Viewcontroller
  7. -(void) Viewdidload {
  8. [Super Viewdidload];
  9. //Create a Uiimagepickercontroller object
  10. Uiimagepickercontroller *ctrl = [[Uiimagepickercontroller alloc] init];
  11. //set type
  12. Ctrl. sourcetype = uiimagepickercontrollersourcetypephotolibrary;
  13. //Set up proxy
  14. Ctrl. Delegate = self ;
  15. //Display
  16. [self presentviewcontroller:ctrl animated:YES completion: nil];
  17. }
  18. -(void) Imagepickercontroller: (uiimagepickercontroller *) Picker didfinishpickingmediawithinfo: ( Nsdictionary *) Info
  19. {
  20. if (picker. sourcetype = = uiimagepickercontrollersourcetypephotolibrary) {
  21. //uiimage *image= [info objectforkey:uiimagepickercontrolleroriginalimage];
  22. Nsurl *asseturl = [info objectforkey:uiimagepickercontrollerreferenceurl];
  23. alassetslibrary *library = [[Alassetslibrary alloc] init];
  24. [Library Assetforurl:asseturl
  25. resultblock:^ (alasset *asset) {
  26. nsdictionary* imagemetadata = [[Nsmutabledictionary alloc] initwithdictionary:asset.  Defaultrepresentation. metadata];
  27. nsdictionary *gps = [Imagemetadata objectforkey: (NSString *) kcgimagepropertygpsdictionary];
  28. NSLog (@ "--------%@", GPS); Location information
  29. NSLog (@ "%@", imagemetadata);
  30. }
  31. failureblock:^ (nserror *error) {
  32. }];
  33. }
  34. }


IOS about image location Privacy Information analysis and Reading

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

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.