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

mysql - FireDac error 314 - but DLLs are in program directory -

git - How to list all releases of public repository with GitHub API V3 -

c++ - Getting C2512 "no default constructor" for `ClassA` error on the first parentheses of constructor for `ClassB`? -