Skip to content

Instantly share code, notes, and snippets.

@tonyedwardspz
Last active August 29, 2015 14:22
Show Gist options
  • Save tonyedwardspz/c90a34627c7d536f7f3f to your computer and use it in GitHub Desktop.
Save tonyedwardspz/c90a34627c7d536f7f3f to your computer and use it in GitHub Desktop.
Metadata tutorial from plymouthsoftware.com
func imagePickerController(picker: UIImagePickerController, didFinishPickingMediaWithInfo info: [NSObject : AnyObject]){
imagePicker.dismissViewControllerAnimated(true, completion: nil)
var selectedImage = info[UIImagePickerControllerOriginalImage] as! UIImage
var metadata: NSDictionary
var library:ALAssetsLibrary? = ALAssetsLibrary()
// Get the images meta data
if(picker.sourceType == .Camera) {
metadata = info[UIImagePickerControllerMediaMetadata] as! NSDictionary
} else {
var referenceURL : NSURL = info[UIImagePickerControllerReferenceURL] as! NSURL
library!.assetForURL(referenceURL, resultBlock: { (asset : ALAsset!) -> Void in
var rep : ALAssetRepresentation = asset.defaultRepresentation()
var metadata : NSDictionary = rep.metadata()
})
{
(error : NSError!) -> Void in
}
}
picker.dismissViewControllerAnimated(true, completion: nil);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment