【发布时间】:2013-12-04 20:57:47
【问题描述】:
我在我的 iOS 应用程序中添加了自动启动(在必需的后台模式下添加 VoIP),它运行良好。然后我想添加 NSTimer。我在 - (id) init 中写了以下内容
NSLog(@"!!!!IT'S START!!!!");
MyTimer = [NSTimer scheduledTimerWithTimeInterval:60 target:self
selector:@selector(StartMyTimer) userInfo:nil repeats:YES];
- (BOOL) StartMyTimer
{
NSLog(@"Timer is wirk");
}
当我的应用程序自动启动时,我会收到一条消息“!!!!IT'S START!!!!”没有人……
如果有人知道问题出在哪里,请帮忙!
【问题讨论】:
-
不是只有当应用程序在前台时才会执行计时器吗?
-
应用启动时必须执行定时器
标签: ios iphone objective-c nstimer autostart