Я просто начать работу с использованием потоков в Obj-C/какао, и я бегу в некоторые проблемы .. Я получаю эту ошибку в консоли:какао ошибка Thread
2010-02-15 09:18:41.467 Timer[1007:4503] *** __NSAutoreleaseNoPool(): Object 0x10012adc0 of class __NSCFDate autoreleased with no pool in place - just leaking 2010-02-15 09:18:41.478 Timer[1007:4503] *** __NSAutoreleaseNoPool(): Object 0x1003362b0 of class NSCFTimer autoreleased with no pool in place - just leaking
здесь код, создает новый поток:
// Timer
JHTimer *timer = [[JHTimer alloc] init];
[timer setMinTextLabel:minTextLabel];
[timer setSecTextLabel:secTextLabel];
[timer setHrTextLabel:hrTextLabel];
timerTimeInt = 30;
[timer setTimerInterval:timerTimeInt];
[NSThread detachNewThreadSelector:@selector(start) toTarget:timer withObject:nil];
и код, который создает autorelease пул (и метод запуска, который создает таймер):
- (void)main {
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
}
- (void)start {
timer = [NSTimer scheduledTimerWithTimeInterval:1 target:self selector:@selector(timerDidUpdate:) userInfo:nil repeats:YES];
NSLog(@"Test");
}
и я могу» t выяснить, что не так
Вы выпускаете ссылку на таймер? – Zinc
Возможно, вы могли бы просто поместить '[self main];' как первую строку в ваш метод 'start'. – dreamlax