NSInteger _count;
NSTimer* _timer;
- (void)tel{ NSLog(@"正在打第%ld个电话",_count++); if(_count>10){ NSLog(@"定时器关闭"); [_timer invalidate]; } }
- (void)timerTest{ _timer=[NSTimer scheduledTimerWithTimeInterval:1 target:self selector:@selector(tel) userInfo:nil repeats:YES]; } main函数中创建对象xxx,然后调用[xxx timerTest];为何什么输出都没有? 我是在command line tool中写的,不是ios项目,不知道是不是这个原因