ARC is a new feature launched by iOS 5, which is called Automation Reference counting ). Simply put, retain/release is automatically added to the Code. The Code that was manually added to handle the reference count of memory management can be automatically completed by the compiler. This mechanism starts to be imported in iOS 5/Mac OS X 10.7 and can be used in xcode4.2. A simple understanding of arc is to allow the compiler (llvm 3.0) to automatically generate the reference count of instances to manage part of the code During code compilation through the specified syntax. One thing is that arc is not a GC, but a static analyzer tool.
In xcode, you often need to import some external code files. If the imported file uses the arc mechanism and your current project does not use the arc, xcode will give a warning or report an error. How can we deal with these problems:
Click the project navigation file --> select targets --> select build phases --> Expand compile sources
At this time, we can see that the name of the second column is:Compiler flags
Double-click the arc file you want to use and enter-Fobjc-Arc,
Now this file can be compiled using the arc Mechanism during compilation.
Same as above. To prevent code using the arc mechanism from using the arc mechanism, you only need to enter -Fno-objc-Arc