Search code examples
iphoneiosobjective-cios6

How to get Exif data from downloaded image


In my application , I need to download the image from particular URL Link and assign that to UIImageView. I do not store that image to my Library, then in this case how can I get the Exif data of this image (like EXIF_TAG_CREATE_DATE , EXIF_TAG_ARTIST, etc) in my app?


Solution

  • try this  
    
    NSError *error = nil;
    NSDictionary *attributes = [[NSFileManager defaultManager] 
        attributesOfItemAtPath:@"imagePath" error:&error];
    
    if (!error) 
    {
        NSLog(@"file attributes : %@",attributes);
    }
    
    and this is the result :
    
    NSFileCreationDate = "2013-05-28 09:29:37 +0000";
    NSFileExtensionHidden = 0;
    NSFileGroupOwnerAccountID = 20;
    NSFileGroupOwnerAccountName = staff;
    NSFileModificationDate = "2013-05-28 09:29:37 +0000";
    NSFileOwnerAccountID = 502;
    NSFileOwnerAccountName = lerhan;
    NSFilePosixPermissions = 420;
    NSFileReferenceCount = 1;
    NSFileSize = 1494;
    NSFileSystemFileNumber = 46795419;
    NSFileSystemNumber = 234881026;
    NSFileType = NSFileTypeRegular;
    
    to access any data type NSLog(@"file creation date : %@",[attributes objectForKey:@"NSFileCreationDate"]);