Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/ssl/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ios4 可以在后台运行计时器吗?_Ios4_Nstimer_Multitasking - Fatal编程技术网

Ios4 可以在后台运行计时器吗?

Ios4 可以在后台运行计时器吗?,ios4,nstimer,multitasking,Ios4,Nstimer,Multitasking,我需要有一个计时器在后台运行,由应用程序调用并输入后台方法。我有点麻烦。当我进入后台时,它什么也不做。这是我的密码 - (void)applicationDidEnterBackground:(UIApplication *)application { bcheckingTimer = [NSTimer scheduledTimerWithTimeInterval:5 target:self selector:@selector(bchecker) userInfo:nil repeats:

我需要有一个计时器在后台运行,由应用程序调用并输入后台方法。我有点麻烦。当我进入后台时,它什么也不做。这是我的密码

- (void)applicationDidEnterBackground:(UIApplication *)application {

 bcheckingTimer = [NSTimer scheduledTimerWithTimeInterval:5 target:self selector:@selector(bchecker) userInfo:nil repeats:YES];

}
- (void)bchecker {

 NSLog(@"Switch is on, will annoy");

}

不。这肯定行不通。当应用程序在后台时,它将被挂起且不运行

您希望使用UILocalNotification类来执行您所说的操作

或者查看关于这些类型的多任务主题的更广泛的讨论