beginBackgroundTaskWithExpirationhandler

Je fais une application où la lecture se fait en arrière-plan. Dans le code suivant, bgTask est non déclaré. De quel type d'objet doit bgTask être?

- (void)applicationDidEnterBackground:(UIApplication *)application 
{
    UIApplication  *app = [UIApplication sharedApplication];
    bgTask = [app beginBackgroundTaskWithExpirationHandler:^{ 
        [app endBackgroundTask:bgTask]; 
        bgTask = UIBackgroundTaskInvalid;
    }];

    dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{});

    [app endBackgroundTask:bgTask]; 
    bgTask = UIBackgroundTaskInvalid;
}
veuillez formater votre code dans le droit chemin.
ok monsieur.........

OriginalL'auteur sidhu | 2010-10-06