Reputation: 147
I can get the .MOV file with the Image Picker, but how can I find the location it was taken at and the time it was taken?
My image picker: - (void) imagePickerController: (UIImagePickerController *) picker didFinishPickingMediaWithInfo: (NSDictionary *) info {
NSString *mediaType = [info objectForKey: UIImagePickerControllerMediaType];
[self dismissViewControllerAnimated:NO completion:nil];
// Handle a movie capture
if (CFStringCompare ((__bridge_retained CFStringRef)mediaType, kUTTypeMovie, 0)
== kCFCompareEqualTo) {
NSString *movieFile = [[info objectForKey:
UIImagePickerControllerMediaURL] path];
NSURL *movieURL = [NSURL fileURLWithPath:movieFile];
NSLog(@"Movie File %@",movieURL);
[self dismissViewControllerAnimated:YES completion:nil];
}
}
Upvotes: 0
Views: 1021
Reputation: 8202
I don't know about the location it was taken but you can use File Attribute Keys
to get the NSFileCreationDate
using attributesOfItemAtPath:error:
. There is a convenience method on NSDictionary
fileCreationDate
NSError *error;
NSDictionary *attributes = [[NSFileManager defaultManager] attributesOfItemAtPath:movieFile error:&error];
if (!attributes) {
// Use the error
}
NSDate *createdDate = [attributes fileCreationDate];
If you want to access the meta-data on the MOV file you can have a look at the EXIF data, I don't know if there is a iOS library for this though.
Upvotes: 1