Sclalertview-swift: fatal error: unexpectedly found nil while unwrapping an Optional value

Created on 18 Sep 2015  ·  3Comments  ·  Source: vikmeup/SCLAlertView-Swift

I can launch my app when I want to display an alert this error appear : fatal error: unexpectedly found nil while unwrapping an Optional value

The error line : let rv = UIApplication.sharedApplication().keyWindow! as UIWindow

Most helpful comment

Window must not be set in viewDidLoad so instead I moved code to viewDidAppear and to works fine.

All 3 comments

Hi, I am getting the same error,
: let rv = UIApplication.sharedApplication().keyWindow! as UIWindow
did you find a solution?

Window must not be set in viewDidLoad so instead I moved code to viewDidAppear and to works fine.

It's right, now it's working, thanks, but maybe this AlertView can be better if it's work in the ViewDidLoad too ...

Was this page helpful?
0 / 5 - 0 ratings

Related issues

samigehi picture samigehi  ·  4Comments

galileomd picture galileomd  ·  3Comments

jlaws picture jlaws  ·  19Comments

ossmalpha picture ossmalpha  ·  16Comments

p0tvin29 picture p0tvin29  ·  3Comments