Is there a way to find out which object is Nil? I get these errors from time to time while coding and normally I have no trouble finding them because I test my code frequently.
Old question and deserved a clean up / extra info.
At the time I asked this, I had no real grasp of what optionals were. If you are having the error stated in the title, read up on optionals and unwrapping them. Basically use guard let
and if let
statements.
If you are here because you simple don't know how to use the debug tools in Xcode, the answers below show screenshots of where to go. The left screen at the bottom shows a list of values, one of them will be Nil