Image on the phone if it's a cell phone, you can use alassetslibrary to get the information color, GPS, size, creation date, etc. of a series of images
Importing a frame assetslibrary.framework using alassetslibrary to introduce a header file
#import <AssetsLibrary/AssetsLibrary.h>
Take the phone album for example code as follows: (get GPS inside timestamp for example)
#pragma-mark Uiimagepickercontroller delegate-(void) Imagepickercontroller: (Uiimagepickercontroller *) Picker Didfinishpickingmediawithinfo: (NSDictionary *) info{Chosenimage= [Info objectforkey:@"Uiimagepickercontrolleroriginalimage"]; //Specifying callback Methods[Picker dismissviewcontrolleranimated:yes completion:null]; 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*gpsdict=[imagemetadata Objectforkey:@"{GPS}"]; NSLog (@"Time: datestamp:%@", [Gpsdict Objectforkey:@"Datestamp"]); } Failureblock:^ (Nserror *error) { }]; }
When the photos and the phone are synced on the phone, I find that there is no information about the creation date or GPs in the dictionary.
I found a way. As long as the picture of the phone, you can get the image creation date method. Other relevant information will be used later to dig deeper.
Nsurl *asseturl = [info objectforkey:uiimagepickercontrollerreferenceurl]; *library = [[Alassetslibrary alloc] init]; [Library Assetforurl:asseturl Resultblock:^ (Alasset *asset) { nsdate* date = [asset Valueforproperty:alassetpropertydate]; NSLog (@ "date:%@", date); } Failureblock:^ (nserror *error) { }];
Second, when the picture in the file form in the sandbox, the main is based on the file path to solve
IOS get File (UIImage) creation time