我正在开发一个使用后台获取的应用。
我需要它每 5 秒在后台执行一次的函数,但是根据我在 google 中看到的代码,SO 决定何时应该调用该函数。
我希望这个函数每 5 秒执行一次。
我的代码在这里:
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
// Override point for customization after application launch.
[[UIApplication sharedApplication] setMinimumBackgroundFetchInterval:UIApplicationBackgroundFetchIntervalMinimum];
return YES;
}
最佳答案
没有办法做到这一点。 iOS 负责决定何时最好让您的应用有机会获取内容:
At appropriate times, the system gives background execution time to the apps that support this background mode, launching the app directly into the background if needed.
(来自docs)
关于objective-c - IOS 7 后台获取,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19821107/