Objective C allow to allocate object through alloc and init

Total Post:16

Points:114
 1053  View(s)
Ratings:
Rate this:

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?

Answer