Note that this method should only be called when the system tells you to perform a Background Fetch.
You can simulate that in Xcode here:
Question
This is my app Delegate
(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);
}
so the issue is performFetchWithCompletionHandler is getting called only ones yes i have done that all in info pList that fetch and all but not help please suggest something
Solution
Note that this method should only be called when the system tells you to perform a Background Fetch.
You can simulate that in Xcode here: