Sunil Targe
Sunil Targe

Reputation: 7459

How to convert ARC project to Non-ARC?

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

Answers (3)

user3540599
user3540599

Reputation: 721

enter image description here

very simple way edit -> covert ->to Objective-C ARC

Upvotes: 1

user529758
user529758

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

Niru Mukund Shah
Niru Mukund Shah

Reputation: 4733

you need to follow this step

  1. go to your project targets - search - Objective-C Automatic Reference Counter

  2. Set NO from YES

Enjoy Progaramming!

Upvotes: 20

Related Questions