I am trying to get the creation date for the pictures stored in the photo library using PHPhotoLibrary. The code works fine for all pictures except for a couple of PNG files that were created as screenshots on the phone by clicking the home and power button. When I iterate through the PHFetchResult and load the CIImage, the PNG files do not contain the TIFF dictionary which contains the creation date for all the other JPG files. I have searched stackoverflow extensively and found similar issues but have not found a solution yet. I have tried loading the files in different ways and have also set the compress PNG files settings to NO in the Build Settings. When I iterate through the PHAssets called pic in PHFetchResult, the PNG image properties return a dictionary with only five elements and no TIFF dictionary. The JPG files all return a much larger dictionary including the TIFF dictionary where I can find the creation date. Here is my current code which returns an empty pictiff dictionary for the PNG files:
[imagemanager requestImageDataForAsset:pic options:ro resultHandler:^(NSData * _Nullable imageData, NSString * _Nullable dataUTI, UIImageOrientation orientation, NSDictionary * _Nullable info) {
CIImage *ciimage = [CIImage imageWithData:imageData];
NSMutableDictionary *exif = [NSMutableDictionary dictionary];
[exif addEntriesFromDictionary:ciimage.properties];
// Get file name
NSURL *picpath = [info objectForKey:@"PHImageFileURLKey"];
NSString *myfilename = [picpath lastPathComponent];
// Get creation date
NSDictionary *pictiff = exif[@"{TIFF}"];
NSString *picdate = pictiff[@"DateTime"];
I would really appreciate some help on getting the creation date for these PNG files.
Deployment target 8.0, Xcode 7.3.1, iPhone 6, iOS 8.4