mercredi 18 février 2015

Swift UIImagePickerController dynamic cast failed in getting path


Vote count:

0




i'm trying to get the path of a photo from UIImagePicker and i'm getting "Swift dynamic cast failed" when i try to get it. Here is my code:



@IBAction func addPhotoButton(sender: AnyObject) {
if UIImagePickerController.isSourceTypeAvailable(UIImagePickerControllerSourceType.SavedPhotosAlbum){

imagePicker.delegate = self
imagePicker.sourceType = UIImagePickerControllerSourceType.SavedPhotosAlbum;
imagePicker.allowsEditing = true

self.presentViewController(imagePicker, animated: true, completion: nil)
}
}


And here where i get the path:



func imagePickerController(picker: UIImagePickerController!, didFinishPickingImage image: UIImage!, editingInfo: NSDictionary!){
self.dismissViewControllerAnimated(true, completion: { () -> Void in
var path: NSURL = editingInfo.valueForKeyPath("UIImagePickerControllerOriginalImage") as NSURL
println(path)
})
}


The app crashes when i try to get the value of the var path



asked 22 secs ago







Swift UIImagePickerController dynamic cast failed in getting path

Aucun commentaire:

Enregistrer un commentaire