Reputation: 7459
As per my knowledge, I know that we use -fno-objc-arc
flag to disable ARC for files that NOT support ARC in an ARC project.
And also we can use -fobjc-arc
flag to enable ARC for files support ARC in a Non-ARC project.
But if I want to convert my ARC project(not particular file) to Non-ARC project, then how should I go ahead for the same?
Anyone please brief me about the same.
Thanks in Advance.
Upvotes: 5
Views: 5803
Reputation:
You have to insert manual memory management method calls in the appropriate places. In general, every new
, alloc
, retain
, copy
and mutableCopy
call shall be balanced by a release
or an autorelease
(the latter is mainly used in the case of return values), so, for example, the following ARC-enabled code:
MyClass *myObj = [[MyClass alloc] init];
[myObj doStuff];
OtherClass *otherObj = [[OtherClass alloc] init];
return otherObj;
should be something like this under MRC:
MyClass *myObj = [[MyClass alloc] init];
[myObj doStuff];
[myObj release];
OtherClass *otherObj = [[OtherClass alloc] init];
return [otherObj autorelease];
More about memory management in the official documentation.
Upvotes: 4
Reputation: 4733
you need to follow this step
go to your project targets - search - Objective-C Automatic Reference Counter
Set NO
from YES
Enjoy Progaramming!
Upvotes: 20