即使应用程序被杀,BackgroundFetch也能正常工作

时间:2014-04-17 12:33:23

标签: ios background fetch

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions{
    [[UIApplication sharedApplication] setMinimumBackgroundFetchInterval:
    UIApplicationBackgroundFetchIntervalMinimum];
}

我设置了上面和下面的最小时间间隔,当app在后台时,方法工作正常并且获取数据10分钟(因为我设置了最小时间间隔)。

- (void) application: (UIApplication *)application performFetchWithCompletionHandler:
(void(^) (UIBackgroundFetchResult))completionHandler{
    fetch data....    
}

上面的performFetchWithCompletionHandler:方法会在应用程序被杀死时运行???

0 个答案:

没有答案