请原谅我的愚蠢问题,但我不明白如何在 ios7 中调用后台提取。这是代码:
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
[application setMinimumBackgroundFetchInterval:20];
return YES;
}
-(void)application:(UIApplication *)application performFetchWithCompletionHandler:(void (^)(UIBackgroundFetchResult))completionHandler
{
NSLog(@"Fetch called");
completionHandler(UIBackgroundFetchResultNoData);
[UIApplication sharedApplication].applicationIconBadgeNumber += 1;
}
问题是我将时间间隔设置为 20 秒,但它只执行一次。这种行为对我来说很奇怪。也许我错了,后台获取的模拟默认只执行一次,但在真实设备上它会定期执行。我怎么能确定它会每 20 秒调用一次?请帮忙!