I have created a NSTimer and call it every 15 seconds. Method that I call makes web servic开发者_如何学Goe 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?
No leak here, but if you want to do something with ws
, don't release
it, autorelease
it instead.
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
.
精彩评论