Reputation: 6829
I have created a NSTimer and call it every 15 seconds. Method that I call makes web service call. In this method I write this code:
GetData *ws = [[GetData alloc]init];
[ws GetSomeData:156];
[ws release];
Here I make instance to a class that call web service method, make a call and release object. Is this approach fine or bad?
Upvotes: 1
Views: 160
Reputation: 10265
That's the right approach. You alloc
it, so you own it, and you must release
it after you've done something with it.
As as side note, your method name GetSomeData
doesn't follow Cocoa naming conventions: it should be someData
.
Upvotes: 1
Reputation:
No leak here, but if you want to do something with ws
, don't release
it, autorelease
it instead.
Upvotes: 3