ios - Getting an error when trying to use imagePickerController Delegate function below: -


when trying use following function

func imagepickercontroller(picker: uiimagepickercontroller,didfinishpickingimage image: uiimage, editinginfo: [string: anyobject]?) {     let selectedimage:uiimage = (editinginfo[uiimagepickercontrolleroriginalimage]) as! uiimage     displayimage.image = selectedimage     self.dismissviewcontrolleranimated(true, completion: nil) } 

getting error: "cannot subscript value of type '[string:anyobject]? index of type 'string'

on second line write let selected image

this has worked fine xcode 6.3 & 6.4 new xcode 7 beta 4 not work , throws error.

help!

try dismissing controller before setting image imageview.
replace methods as:

func imagepickercontroller(picker: uiimagepickercontroller, didfinishpickingmediawithinfo info: [nsobject : anyobject]) {  self.dismissviewcontrolleranimated(true, completion: nil) let selectedimage:uiimage = (editinginfo[uiimagepickercontrolleroriginalimage]) as! uiimage displayimage.image = selectedimage  } 

Comments

Popular posts from this blog

Fail to load namespace Spring Security http://www.springframework.org/security/tags -

sql - MySQL query optimization using coalesce -

unity3d - Unity local avoidance in user created world -