Users Pricing

forum

home / developersection / forums / objective c allow to allocate object through alloc and init

Objective C allow to allocate object through alloc and init

Anonymous User 2050 18 Aug 2015

What is the difference between the following 2 ways to allocate and init an object?

AController *tempAController = [[AController alloc] init];

self.aController = tempAController;

[tempAController release];

and

self.aController= [[AController alloc] init];

Most of the apple example use the first method. Why would you allocate, init and object and then release immediately?


I am a content writter !


0 Answers