I'm trying to present a UIViewController
like this:
let autocompleteVC = GMSAutocompleteViewController()
autocompleteVC.delegate = self
self.present(autocompleteVC, animated: true, completion: nil)
The VC is shown for a second and then the app crashes, Xcode breakpoints on a non-relevant line (self.buttonsScrollView!.frame.origin.y = (self.window?.frame.size.height)! - self.bounds.size.height
) in another class and if delete this line I get an fatal error: unexpectedly found nil while unwrapping an Optional value
error.
*The question isn't what does fatal error: unexpectedly found nil while unwrapping an Optional value
means - the question is why does it crashes when I'm using the present
method.
Any idea why does this happen?
Thank you!