Upgrade to Pro — share decks privately, control downloads, hide ads and more …

iOS 7 - Background Fetching (CocoaHeads Lyon octobre 2013)

iOS 7 - Background Fetching (CocoaHeads Lyon octobre 2013)

Vincent Tourraine

October 11, 2013
Tweet

More Decks by Vincent Tourraine

Other Decks in Programming

Transcript

  1. Pour quoi faire ? ➡ Télécharger des nouvelles données sans

    ouvrir l’application ➡ Exécution régulière en tâche de fond
  2. Appel en tâche de fond - (void)application:(UIApplication *)application performFetchWithCompletionHandler: (void

    (^)(UIBackgroundFetchResult))completionHandler { [self.manager GET:@"http://example.com/resources.json" parameters:nil success:^(id operation, id responseObject) { completionHandler(UIBackgroundFetchResultNewData); } failure:^(id operation, NSError *error) { completionHandler(UIBackgroundFetchResultFailed); }]; }
  3. Plus d’infos • UIApplication Class Reference https://developer.apple.com/library/ios/documentation/uikit/reference/ UIApplication_Class/Reference/Reference.html • UIApplicationDelegate

    Protocol Reference https://developer.apple.com/library/ios/documentation/uikit/reference/ UIApplicationDelegate_Protocol/Reference/Reference.html