5/20/2023 0 Comments Storyboard quick 6.1 reviews![]() ![]() swift file of the class and pay attention to the parameters and letter casing to make sure it matches. So now you can go back to your code and see where you’re calling the “dealTapped” method and why the object doesn’t have that method.Ĭheck if that method exists in the. “Selector” is another term for a method.Īs you can see in the error message above, it tells you the method that was called was “dealTapped” and the object that it was called on was a ViewController object. The unrecognized selector error means that somewhere, a method was called on an object and that object didn’t have that method so it crashes. So now that you know how to find the actual error message when your app crashes, the next step is to learn to recognize some of the more common types of messages because they will hint at what’s wrong. Unrecognized selector sent to instance error When your app runs and then crashes (as soon as it runs or after you click something), you need to know where to find the error message to understand exactly what went wrong.Īfter the crash, go to Xcode in the lower right hand pane, scroll all the way to the top. App Runs And Then Crashes Finding the error message after a crash So you can see why beginners may accidentally have set breakpoints and not realize it when they run their app! 2. You can set breakpoints by clicking the gutter beside a line of code and it’ll add a little blue marker there. I see this happening a lot for beginners who aren’t aware of what breakpoints are.īreakpoints are used to halt execution at a certain point so that you can inspect variables and peek into your objects to debug. Or you can disable all breakpoints by this menu command in Xcode: All you need to do is to either remove the breakpoint by clicking the blue marker and dragging it off the gutter (and then re-run your app). If you see something like the above screenshot, that means that you’re seeing a black screen because the app execution has stopped. Run your app, then bring Xcode to the foreground and see if you see something like the below with a green line (representing where execution has halted) stopped at a blue marker (which is a breakpoint): If that still doesn’t work, then maybe you have accidentally set some breakpoints which is stopping the app execution. Secondly, I would reset the simulator like I mentioned above and try to run my app again. ![]() Sometimes it can take up to 15 seconds to launch your app initially. If you run your app and the iOS simulator is showing a black or white screen, I would first wait a little while. My simulator screen is black or white when the app runs You can also hit command + 1-3 on your keyboard as shortcut keys to control the zoom level of your simulator. By default, the zoom level is “Physical Size.” The frame or bezel on the simulator also differs from level to level so if you don’t see an iPhone bezel on your simulator, try changing your zoom level to either “Physical Size,” “Point Accurate,” or “Pixel Accurate” as shown in the screenshot below. If your iPhone simulator doesn’t look like the one you see me using in my videos, it’s because your iOS simulator is at a different zoom level. Xcode Simulator Errors My iPhone simulator looks different? – Can’t drag UIElements onto my Storyboardġ. – Xcode complains that a method of some class doesn’t exist – Unexpectedly found nil while unwrapping an optional value – This class is not key value coding-compliant for the key… – Finding the error message after a crash – My simulator screen is black when the app runs This handy reference guide will show you what the common causes for these errors are and give you steps to fix them! Updated on Jby David Ruvinskiy and Chris ChingĪre you getting strange error messages like “Thread 1: signal sigabrt” or “Use of unresolved identifier”?
0 Comments
Leave a Reply. |