from: iOS Good Practices
The Clang compiler (which Xcode uses) has a static analyzer that performs control and data flow analysis on your code and checks for lots of errors that the compiler cannot.
You can manually run the analyzer from the Product → Analyze menu item in Xcode.
The analyzer can work in either “shallow” or “deep” mode. The latter is much slower but may find more issues due to cross-function control and data flow analysis.
Recommendations:
- Enable all of the checks in the analyzer (by enabling all of the options in the “Static Analyzer” build setting sections).
- Enable the “Analyze during ‘Build’” build setting for your release build configuration to have the analyzer run automatically during release builds. (Seriously, do this — you’re not going to remember to run it manually.)
- Set the “Mode of Analysis for ‘Analyze’” build setting to Shallow (faster).
- Set the “Mode of Analysis for ‘Build’” build setting to Deep.
时间: 2024-10-18 10:46:00