好的,我正在查看SimpleBackgroundFetch示例项目,它在App Delegate中使用以下内容:
[[UIApplication sharedApplication] setMinimumBackgroundFetchInterval:someTimeInSeconds]; //^this code is in didFinishLaunchingWithOptions -(void)application:(UIApplication *)application performFetchWithCompletionHandler:(void (^)(UIBackgroundFetchResult))completionHandler { //do something + call completionHandler depending on new data / no data / fail }
所以,基本上我假设,我在这里调用我的应用程序服务器,以获取一些数据.@H_301_5@
但后来我看到了NSURLSession docs,它有这样的方法@H_301_5@
– downloadTaskWithURL:
并说它如下:@H_301_5@
This API provides a rich set of delegate methods for supporting
authentication and gives your app the ability to perform background
downloads when your app is not running or,in iOS,while your app is
suspended.@H_301_5@
那么这两个API之间的区别是什么?如果我想不时地从我的应用程序的服务器下载一些数据,我应该使用什么?@H_301_5@
我只是不确定两者之间的区别,所以我只是觉得我应该在这里澄清我的怀疑.去StackOverflow!@H_301_5@