Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

iOS7 Background Fetch

I am trying to implement the new iOS7 app refresh. I don't think it's working properly.

I add into the info.plist

Required background modes - App downloads content from the network

In my main view controller,

  1. UIApplicationDelegate is set as delegate
  2. In Viewdidload I put in [[UIApplication sharedApplication] setMinimumBackgroundFetchInterval:1.0];

  3. I add the following method

    - (void)application:(UIApplication *)application 
        performFetchWithCompletionHandler: 
        (void (^)(UIBackgroundFetchResult result))completionHandler {
            NSLog(@"Refresh from Background");
    }
    


I plug in my iPhone and launch the app and then I got to Debug -> Simulate Background Fetch

The NSLog does not print. (If my app is in the foreground, it will put it in the background)

Thanks!

like image 932
Alan Avatar asked Oct 07 '13 19:10

Alan


1 Answers

You can review apple's demo code from below link

http://adcdownload.apple.com/wwdc_2013/wwdc_2013_sample_code/52012_ios_simplebackgroundtransfer.zip

i tried fetching data in background in my app. It is working fine.

like image 107
Hemal Modi Avatar answered Oct 28 '22 13:10

Hemal Modi