I'm working on an internal app that requires to check the server every 10 mins or so when the application enters background. Normally, I can use APNS when new record arrives.

However, this app will completely skip Apple's garden, so no APN and yes private API.

So the question, is there any way for me to set the background fetch interval directly instead of calling the normal application setMinimumBackgroundFetchInterval:

I also welcome other ideas for the same result.

有帮助吗?

解决方案

I recommend implement VOIP background mode, because is simply and provide app wakeup every few minutes. Just set Voice over IP in Background Modes and register handler;

Example:

[[UIApplication sharedApplication] setKeepAliveTimeout:600 handler:^{
       NSLog(@"Here I do something every 600 seconds");
 }];

This method more preferable because can work on old iOS, and timeout is fixed vs background fetch where timeout is calculated by user activity and app usage.

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top