I am using a thread to update messages in the background in my application. The thread starts in my message class.
Messages .m
timerThread = [[NSThread alloc] initWithTarget:self
selector:@selector(startTimerThread:) object:nil];
[timerThread start];
Now I want the thread to stop when the user writes out the application. For this, in the signout method (in another class), I added
Messages *msg=[[Messages alloc]init];
[msg.timerThread cancel];
[msg release];
But even after exiting the application, the thread still works.
source
share