这是我的应用代表
(BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
[[UIApplication sharedApplication] setMinimumBackgroundFetchInterval:2];
self.window = [[[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]] autorelease];
// Override point for customization after application launch.
self.viewController = [[[ViewController alloc] initWithNibName:@"ViewController" bundle:nil] autorelease];
UINavigationController *nav=[[[UINavigationController alloc]initWithRootViewController:self.viewController ] autorelease];
nav.navigationBar.hidden=YES;
self.window.rootViewController = nav;
[self.window makeKeyAndVisible];
return YES;
}
-(void)application:(UIApplication *)application performFetchWithCompletionHandler:(void (^)(UIBackgroundFetchResult))completionHandler
{
NSLog(@"########### Received Background Fetch ###########");
//Download the Content .
[self sometask]; // i want to do some task here but this method get called only ones when i try to launch application
//Cleanup
completionHandler(UIBackgroundFetchResultNoData);
}
所以问题是performFetchWithCompletionHandler只被调用了是的我已经完成了所有的信息pList获取和所有但没有帮助请建议
答案 0 :(得分:2)
请注意,只有在系统要求您执行后台提取时才会调用此方法。
你可以在Xcode中模拟它: