After iOS4.1, the ARC mode is the default, and arc is essentially implemented with compiler features, which can be implemented simply by modifying the file configuration.
1. To switch to MRC you need to select the current project, choose Build Settings, type Auto in the query box, find Objective-c Automatic Reference counting, and select Yes to No. See:
2. You can also flexibly select single or several files to be set to ARC mode, by selecting targets, finding compile Sources, selecting the desired file, flags, typing-FOBJC-ARC. See:
3. You can also flexibly select single or several files to be set to MRC mode by selecting targets, finding compile Sources, selecting the desired file, flags, typing-FNO-OBJC-ARC. See:
Memory management principles: 1 who Created (Alloc,new), who release or autorelease;2) who retain,mutablecopy (copy), who release or autorelease; MRC: Manual memory management When new objects appear, manually add release or Autorelease. ARC Works: Arc is a feature of the Objective-c compiler, not a runtime feature or garbage collection mechanism, and arc does nothing but automatically insert release or autorelease at the appropriate location for you when the code is compiled. ARC's judging criteria: as long as there is a strong pointer variable pointing to the object, the object remains in memory. As long as no strong pointer points to the object, the object is freed. Note: When using arc, temporarily forget "reference counter" because the judging criteria has changed
MRC and ARC Hybrid Development configuration