devaditya
devaditya

Reputation: 331

Returning an array without a Leak!

[sender LoadDataComplete:arrDetailData]; I am returning this array like this from an objective C class in my my class which inherits ViewController...if I write [arrDetailData release] below this...i get crash... Please advise on it...how to get this array without a leak

Upvotes: 3

Views: 209

Answers (3)

Sat
Sat

Reputation: 1626

when you are using [array relese] it will release the object very soon it may crash your app..so use autorelese..If you mean you want to remove the objects from array use [array RemoveAllobjects].. Refer about memory management

Upvotes: 0

Robin
Robin

Reputation: 10011

@devaditya you should use autorelease instead of release

[arrDetailData autorelease];

you can write this statement before the return statement.

Upvotes: 2

Viraj
Viraj

Reputation: 1890

Why don't you autorelease it ?

Upvotes: 3

Related Questions