iphoneobjective-calassetassetslibrary

ALAsset timestamp returns wrong date


I am trying to get the timestamp of images, I can get the correct latitude and longitude values, but the timestamp always returns the current time, not the EXIF time of the image.

ALAssetsLibraryAssetForURLResultBlock resultsBlock = ^(ALAsset *asset) {
    CLLocation *imageLoc = [asset valueForProperty:ALAssetPropertyLocation];
    NSDateFormatter *formatter = [[NSDateFormatter alloc] init];
    [formatter setDateFormat:@"dd/MM/YY HH:mm:ss"];
    NSString *trailTime = [formatter stringFromDate:imageLoc.timestamp];
    NSLog(@"---+++ image TimeStamp: %@", trailTime);
    [formatter release];

Any help appreciated, thanks


Solution

  • OK I found the answer What gave me the entire metadata in dictionary format was:

    NSDictionary *metadata = asset.defaultRepresentation.metadata; 
    

    //Hope this helps others.