Static Analyzer
-
Xcode’s static analyzer can help you find bugs in your code before you even run it.
-
To perform static code analysis, select Product > Analyze in the menu bar. The Xcode static analyzer parses the project source code and identifies these types of problems:
-
Logic flaws, such as accessing uninitialized variables and dereferencing null pointers
-
Memory management flaws, such as leaking allocated memory
-
Dead store (unused variable) flaws
-
-
For example, here’s how the static analyzer can find a memory leak:
-
See Appendix: The Static Analyzer for more details.