Over a million developers have joined DZone.

Embrace Xcode (Clang) Compiler Errors

DZone's Guide to

Embrace Xcode (Clang) Compiler Errors

Compiler errors and warnings don't exist just to clutter your IDE. Here are some tips on dealing with errors you'll find in Xcode.

· Mobile Zone
Free Resource

Download this comprehensive Mobile Testing Reference Guide to help prioritize which mobile devices and OSs to test against, brought to you in partnership with Sauce Labs.

Have you ever felt the stress and frustration when your issue navigator is full of warnings and errors? My advice is: Leave your bad feelings behind.

Believe or not, compiler warnings and errors are your best friends.

Why am I saying this? Because the ability to catch bug, or a possible problem in your code at the early stage at the development allow you to fix it or redesign it before it goes
to production. And because the warnings and errors can help you better understand the problem, and finally you will be able produce better code. So that is why you won’t try to quickly fix them, looking for a temporary solution, where you can switch off the given warning!

Always get to the root cause, because you gain knowledge and the first step in problem solving always starts with the understanding of the problem.

Here are my tips for you:

  1. Always switch on the static code analyzer in Xcode.

  2. Always solve the issues you have in the Issue Navigator first, before you are adding new functionality or code (see point #5 in The Joel Test).

  3. Don’t run your code first, always build it (cmd ⌘+b). This is when clang generates the errors. If no errors, you can run your current project.

  4. When you are unsure about the issue navigator is properly updated, try to clear (shift ⇧+ cmd ⌘+k , and build again (cmd ⌘+b).

  5. Do whatever you want to do, but try not to make shortcuts or cheating when you need to solve those problems.

I hope with this short post I could help you again to produce better code, and getting a more valuable iOS/macOS developer.

Analysts agree that a mix of emulators/simulators and real devices are necessary to optimize your mobile app testing - learn more in this white paper, brought to you in partnership with Sauce Labs.

xcode ,errors ,clang ,mobile

Published at DZone with permission of Peter Molnar, DZone MVB. See the original article here.

Opinions expressed by DZone contributors are their own.

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}