J'ai récemment revisité mon application qui a été construite pour iOS 8.4 et qui est maintenant mise à jour vers 9.3. Il fonctionnait très bien les premières fois je l'ai couru, mais se brise maintenant sur tous ouverts, sur chaque simulateur avec l'erreur: EXC_BAD_ACCESS (code = 50)Crash iOS sur Démarrer Tâche de fond
-(void)beginBackgroundUpdateTask
{
if (self.backgroundTaskAgent == UIBackgroundTaskInvalid)
{
self.backgroundTaskAgent = [[UIApplication sharedApplication] beginBackgroundTaskWithExpirationHandler:^(void) {
[self endBackgroundUpdateTask];
}];
}
}
-(void)endBackgroundUpdateTask
{
if (self.backgroundTaskAgent != UIBackgroundTaskInvalid)
{
[[UIApplication sharedApplication] endBackgroundTask:self.backgroundTaskAgent];
self.backgroundTaskAgent = UIBackgroundTaskInvalid;
}
}
L'accident se produit dans la méthode top avec beginBackgroundTaskWithExpirationHandler. Je n'ai jamais eu cette erreur auparavant et je ne trouve aucune solution pour moi-même ou sur SO.
Alors, que l'erreur ne McKee faire? – SeanChense
Fantastique, ça l'a beaucoup aidé. Qu'est-ce qui causait l'erreur alors? –
votre tâche bg doit être invalide avant de recommencer! – Lion