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
Post a Comment