1. PrefaceBecause the company has a foreign catering system, programming and development for 3-4 years, before the use of all non-arc, development to this year, the first batch of iterative development of the personnel has been missing, and now found that there is a lot of memory leaks, the system does not automatically release the freed memory. Once the app has been in use for a long time, memory is not released and the app is eventually blown. It involves a lot of places, especially complicated. Therefore, I have the intention to fully convert this project to the ARC project. After 1 weeks of conversion and 1 weeks of testing, the non-ARC project was successfully converted to the ARC project. There is very little information on the web because there are few companies that can convert large old apps into arcs. After this attempt, I proved that it was feasible. Let's summarize some of the problems I've encountered in the blog. After all, arc is the OBJC future. Xcode comes with an auto-convert feature, but it's only suitable for smaller projects and is not suitable for large projects, so I'm here for full manual conversions.2. Change the project compilation environment to ARC
Change the red circle from No to Yes
If your current project does not support arc technology, you can use an automatic conversion tool to convert your project (tools at Edit>refactor>convertto objective-c ARC), this tool automatically converts the points in the manual management of all projects into the appropriate automatic mode (such as removing retain, release, etc.). This tool will convert all the files in the project. Of course you can convert individual files.3. The following functions: Dealloc,retain, Release, Retaincount, Autorelease. Prohibit any form of invocation and implementation (Dealloc may be implemented)
Erase or annotate all these memory-management things
4. You cannot use nsautoreleasepool. You can consider direct annotations
As an alternative, @autoreleasepool is introduced and you can use this more efficient keyword.
5. Do bridging conversion times wrong, replace with Xcode hint
some rules of 6.ARC syntax
6.1. Retain, release, retain, Autorelease are not available in the code
6.2. Do not overload the Dealloc (the function can be overloaded if it is disposed of outside the object's memory, but cannot be called [Super Dealloc])
6.3. Cannot use Nsallocateobject, Nsdeallocateobject
6.4. Object pointers cannot be used in C struct bodies
Between 6.5.id and void * If cast requires a specific method (__bridge keyword)
6.6. Cannot use NSAutoreleasePool, but need @autoreleasepool block
6.7. The name of the property that cannot be started with "new" (if used there will be a compile error below "Properties ' s synthesized getter follows COCOA naming convention for returning ' owned ' O Bjects ")
7. Third-party package issues, third-party framework issuesMany third-party frameworks may be referenced in our project. Most of them use macros to allow the code to adapt to both arc and non-arc(with # if __has_feature (OBJC_ARC))。 If you have a small amount of code, consider rewriting it yourself. You can manually rename the third-party frame yourself to arc if it is a large frame, you can take this framework to keep the non-arc environment intact and continue to use it.1, select the targets in the project, select the target you want to manipulate ,
2, choose Build phases, in which Complie sources select the file that needs arc double-click, and enter in the input box:-FOBJC-ARC, if not arc input:-fno-objc-arc Clear Saup
Source: http://www.cnblogs.com/qingche/
This article is copyright to the author and the blog Park is shared, welcome reprint, but must retain this paragraph statement, and in the article page obvious location to give the original text connection.
ios-How to convert a non-ARC project into an arc project (actual combat)