For some reason this is outputting ‘null’. The code seems to be right according to what everyone else has been saying about MediaMetaData, but unlike them, all i get out is the null?
- (void)imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary *)info {
NSDictionary *metadata = [info objectForKey:UIImagePickerControllerMediaMetadata];
NSLog(@"%@", metadata);
}
Edit: I’m using a UIImagePickerController, which gets the image from the iPhone simulator’s PhotoLibrary.
Also I’m using iOS 4.3
When I use NSLog(@”%@”, info); that outputs:
UIImagePickerControllerMediaType = “public.image”;
UIImagePickerControllerOriginalImage =
“”;UIImagePickerControllerReferenceURL =
“assets-library://asset/asset.PNG?id=1000000001&ext=PNG”;
I’ve tried different pictures, different filetypes. No change.
Excerpt for
UIImagePickerControllerMediaMetadatafrom the documentation,You will have to use the Asset Library for this. Specifically build an
ALAssetinstance and access themetadataproperty of itsdefaultRepresentation.