开发者

objective-c iphone programming : background task every 10 minutes

i want my application to execute a specific me开发者_运维问答thod each 10 minutes while in background It is possible ? Thanks


If I understood your question correctly... do you mean after the user hits the Home button?

If so, then I believe it is not possible to do what you want to do.

From apple docs the iOS application can become active in the background to do one or more of the following:

  1. Task completion: when the app starts a task and the user hit the home button the app can ask to continue doing the task for a limited time in the background then enters the suspended state

  2. Location: the app becomes active for limited time when location change is triggered.

  3. For playing audio

  4. VOIP

Have a look at the multitasking guidelines docs.

Cheers


minutesTimer = [NSTimer scheduledTimerWithTimeInterval:60*10 target:self selector:@selector(update) userInfo:NULL repeats:YES];


if ([countTimer isValid]==NO)
{
    countTimer=[NSTimer scheduledTimerWithTimeInterval:600 target:self selector:@selector(YourMethod) userInfo:nil repeats:YES];
}
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜