Sunday, January 22, 2012

ARC part 3: Convert existing project into ARC



You may convert an existing app of yours to ARC without any issues, after converting your app to ARC you will get a huge error list wherever in your app you have made calls to release, retain or autorelease.There is one simple way to do this and that is let your xcode do the conversion for you and for that all you have to do is from the edit menu of the xcode select refractor and then select the convert to objective c arc option.



While doing this conversion xcode will guide you on what all changes will be done to your project just go with the flow and finally you will have your project converted into ARC.

Once it is done try to build your application you will get a list of errors where ever you have used retain, release or autorelease just remove call to those keywords and the app should be fine.

Run your application to make sure that its running smooth and if not then go through your code and see where the problem is and remember the concept of strong and weak pointer in case of any issues.

In my next post i will show you how to build an application from start by using ARC.

Happy iCoding and have a great Day.

1 comment:

  1. Hello Sir,
    how can i write [NSStream getStreamsToHostNamed: @"192.168.1.20" port:8051 inputStream:&iStream outputStream:&oStream]; in ARC because it's giving error.

    Thanks...

    ReplyDelete