Something marked with ! (or an implicitly unwrapped IBOutlet) was nil at runtime. Replace the force unwrap with if let, guard let or a default value.
let text = field.text // String?
let a = text! // crashes if nil
if let a = text { print(a) } // run only when present
guard let b = text else { return } // exit early
print(b)
let c = text ?? "" // default valueIBOutlets: aniloutlet usually means the connection in Interface Builder is broken or the property is used beforeviewDidLoad. Check for a yellow warning or an empty circle next to the outlet.- Failable initializers and lookups such as
URL(string:),Int("abc")or dictionary subscripts return optionals; handle thenilcase. try!andas!crash the same way; prefertry?,do/catchandas?.
When this crash happens on a user's device, Bugsee shows the symbolicated stack trace, the screen and the steps before it. Learn more
