ios - imagePickerController error selecting a Photo -


i'm using imagepickercontroller, when select imagen got error:

fatal error: unexpectedly found nil while unwrapping optional value

i dont know why because im unwrapping value if let

  func imagepickercontroller(picker: uiimagepickercontroller, didfinishpickingmediawithinfo info: [nsobject : anyobject]) {      if let img = info[uiimagepickercontrolleroriginalimage] as? uiimage {         photoimageview.image = img     }      dismissviewcontrolleranimated(true, completion: nil) } 

does error occurs @ line

photoimageview.image = img 

in case might photoimageview nil (it implicitly unwrapped optional).

updated comments:

please check photoimageview @iboutlet , connected uiimageview on storyboard. if creating programmatically, try adding view in window before setting image.


Comments

Popular posts from this blog

html - Firefox flex bug applied to buttons? -

html - Missing border-right in select on Firefox -

python - build a suggestions list using fuzzywuzzy -