Click here to Skip to main content
15,886,110 members
Articles / Mobile Apps / iOS

Super-Charge iOS Debugging With Static Analysis & Clang!

Rate me:
Please Sign up or sign in to vote.
3.00/5 (1 vote)
16 Jun 2010CPOL1 min read 13.8K   1   1
Super-Charge iOS Debugging with Static Analysis & Clang!

Post image for Super-Charge iOS Debugging With Static Analysis & Clang!

Tired of peaky memory leaks and random crashes in your apps? Trouble finding out where exactly the errors are coming from? Me too! That is why I am so excited to show you a real easy way to get help from XCode.

Static Analysis With XCode

Clang is an open source project that is meant to help programmers identify problems in code. This open source project has been integrated into the latest versions of XCode so that Apple developers can use this to help debug their Mac, iPhone, iPad and iOS applications.

This idea of static analysis goes way beyond what most people are used to when it comes to debugging software. XCode has a much deeper understanding of your code – the static analyzer will travel down each possible path and identify logical errors like unreleased memory (a vexing problem for iOS developers) and dead stores (areas of code that are never read usually indicating a serious logical error).

How to Use XCode’s Static Analysis Feature (Clang)

Using this feature in XCode is so easy that I just stumbled across it one day when I was facilitating one of my intensive three day iPhone Development seminars. Because someone asked, I tried out the “Build and Analyze” option and XCode instantly pointed out the memory leak I was trying to demonstrate.

So here is how you do it: simply open the project that you want to analyze and go to XCode, Build and then Build & Analyze:

Now build your project and if you have any logical errors, you will see them highlighted with blue:

Even cooler if you click on the blue icon that appears, you will get more information visually if the form of blue arrows and details about what specifically the issues are:

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
United States United States
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.

Comments and Discussions

 
GeneralLeather Jackets Pin
mariajim16-Jun-10 21:24
mariajim16-Jun-10 21:24 
This article describes way of protected and unnoticeable announcement between software inside Virtual Machine and software running on the host. :cool


Thanks

Maria Jim
<a href="http://www.padana.com/products.asp?MSecID=3" title="Leather Jackets">Leather Jackets</a> Manufacturers

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.