Over a million developers have joined DZone.
{{announcement.body}}
{{announcement.title}}

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

Launching an app doesn’t need to be daunting. Whether you’re just getting started or need a refresher on mobile app testing best practices, this guide is your resource! Brought to you in partnership with Perfecto

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.

Keep up with the latest DevTest Jargon with the latest Mobile DevTest Dictionary. Brought to you in partnership with Perfecto.

Topics:
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.

THE DZONE NEWSLETTER

Dev Resources & Solutions Straight to Your Inbox

Thanks for subscribing!

Awesome! Check your inbox to verify your email so you can start receiving the latest in tech news and resources.

X

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

{{ parent.tldr }}

{{ parent.urlSource.name }}