Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

iOS ARC complete?

A former developer built a well-written iPhone app for our organization. After he quit, another developer updated the app for Automatic Reference Counting (ARC). This developer is no longer here. I don't trust what he did as he was an unscrupulous developer. I have 15 years of development experience, but I am new to iPhone development. I need to know if I should leave his changes intact. I have carefully compared the changes he made. He only took out the dealloc functions and removed use of 'release', 'retain', and 'autorelease'. From what I've read http://developer.apple.com/library/ios/#releasenotes/ObjectiveC/RN-TransitioningToARC/Introduction/Introduction.html:

You cannot explicitly invoke dealloc, or implement or invoke retain, release, retainCount, or autorelease.

This should be ok.

However, this article

http://www.learn-cocos2d.com/2011/11/everything-know-about-arc/

mentions

With LLVM 3.0 selected as compiler the Build Setting Objective-C Automatic Reference Counting can be set to YES.

This setting is still set to NO. It seems to me that the code was updated to use ARC but the project is not configured for ARC. Can you please tell me how to continue?

like image 625
lil mmd Avatar asked Mar 23 '23 12:03

lil mmd


1 Answers

Well, that parameter has to be set to YES, probably the code is leaking everywhere.

You can check if the project is leaking using the Analyzer (Product -> Analyze).

If ARC is disabled and the releases are removed from the code, the analyzer will inform you that your code is leaking, and where.

So, after enabling ARC, the analyzer wont give you any leaks.

Another way of checking if ARC is disabled or enabled is using release or autorelease in your code. If ARC is enabled, you should see a warning or an error.

like image 183
Antonio MG Avatar answered Apr 01 '23 21:04

Antonio MG