O'Reilly logo

Programming iOS 4 by Matt Neuburg

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Static Analyzer

From time to time, you should use the static analyzer to look for possible sources of error in your code; choose Product → Analyze (Shift-Command-B). This command causes your code to be compiled, and the static analyzer studies it and reports its findings in the Issue navigator and in your code.

The static analyzer is static — it’s analyzing your code, not debugging in real time — but it is remarkably intelligent and may well alert you to potential problems that could otherwise escape your notice. For example, there are two memory leaks in the Empty Window project as we’ve developed it in previous chapters; this is deliberate, because we haven’t yet discussed memory management (we’ll discuss it, and fix these leaks, in Chapter 12). The static analyzer correctly reports them.

The static analyzer isn’t perfect, and can result in false warnings, but think of it as notifying you of things to think about rather than as listing definite issues. For more about the static analyzer, see http://clang-analyzer.llvm.org.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required