Vous avez eu un problème avec crashlytics.com.apple.main-thread EXC_BAD_ACCESS KERN_INVALID_ADDRESS (à NSTimer à partir d'iOS 8.x)
Crashed: com.apple.main-thread
0 libobjc.A.dylib 0x197e37bdc objc_msgSend + 28
1 Foundation 0x1881192c8 -[NSCFTimer initWithFireDate:interval:target:selector:userInfo:repeats:] + 140
2 Foundation 0x188123d3c +[NSTimer(NSTimer) scheduledTimerWithTimeInterval:target:selector:userInfo:repeats:] + 140
3 RV PetSafety 0x1000fd2a0 -[HomeViewController UIApplicationDidBecomeActive:] (HomeViewController.m:179)
4 CoreFoundation 0x1872dc1e0 __CFNOTIFICATIONCENTER_IS_CALLING_OUT_TO_AN_OBSERVER__ + 20
5 CoreFoundation 0x18721b370 _CFXNotificationPost + 2060
6 Foundation 0x188116cc0 -[NSNotificationCenter postNotificationName:object:userInfo:] + 72
7 UIKit 0x18bb664c0 -[UIApplication _stopDeactivatingForReason:] + 464
8 UIKit 0x18bd77818 -[UIApplication _handleNonLaunchSpecificActions:forScene:withTransitionContext:] + 2664
9 FrontBoardServices 0x18f56d640 __31-[FBSSerialQueue performAsync:]_block_invoke + 28
10 CoreFoundation 0x1872ee124 __CFRUNLOOP_IS_CALLING_OUT_TO_A_BLOCK__ + 20
11 CoreFoundation 0x1872ed22c __CFRunLoopDoBlocks + 312
12 CoreFoundation 0x1872eb850 __CFRunLoopRun + 1756
13 CoreFoundation 0x1872191f4 CFRunLoopRunSpecific + 396
14 GraphicsServices 0x1903835a4 GSEventRunModal + 168
15 UIKit 0x18bb4a784 UIApplicationMain + 1488
16 RV PetSafety 0x1001161e8 main (main.m:14)
17 libdyld.dylib 0x198492a08 start + 4
Où mon code:
- (void)UIApplicationDidBecomeActive:(NSNotification *)notification {
if([updateTimer isValid]) {
[updateTimer invalidate];
}
updateTimer = [NSTimer scheduledTimerWithTimeInterval:refreshInterval
target:self
selector:@selector(refreshData)
userInfo:nil
repeats:YES];
}
Chaque fois que mon application devient actif que je veux mettre à jour mon NSTimer
temps. Je dois appeler API période de temps. J'ai eu un accident sur cette méthode. Sur la méthode de sélection ci-dessus refreshData
ayant un appel d'API. NSNotificationCenter
à Initialisation viewWillAppear
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(UIApplicationDidBecomeActive:)
name:UIApplicationDidBecomeActiveNotification object:nil];
Crashlytics titre HomeViewController.m line 179 -[HomeViewController UIApplicationDidBecomeActive:]
sur cette ligne
updateTimer = [NSTimer scheduledTimerWithTimeInterval:refreshInterval
target:self
selector:@selector(refreshData)
userInfo:nil
repeats:YES];
Je ne vu aucun [[NSNotificationCenter defaultCenter] removeObserver:self name:UIApplicationDidBecomeActiveNotification object:nil];
dans ce projet. Juste maintenant j'ajoute cela mais, je veux confirmer est un accident se produire en raison de multiples addObserver
ou en NSTimer
initialisation?
Mise à jour 16/08/2017:
Vous avez ce couple d'erreur de temps et à la fois la même version iOS 8.x
iOS version: 8.4.1 (12H321)
modèle: iPhone 5c (modèle A1456, A1532)
Mise à jour 17/08/2017:
Le premier accident est survenu il y a plus de trois mois et le deuxième s'est produit plus de deux semaines. Je ne peux pas obtenir les détails de l'accident dans l'onglet crash Xcode-organizer
. J'ai vu un autre accident seulement dans Crashlytics
, pas dans Xcode-organizer
. Je ne comprends pas Crashlytics
détails crash comparer à Xcode-organizer
Si vous avez ajouté ce obeserver BecomeActive? – CodeChanger
à 'HomeViewController'' viewWillAppear' mentionné dans la question ci-dessus code init initate. – user3589771
Y at-il un autre viewController dans votre application ou vous juste chez Home ViewController et obtenir ce plantage? – CodeChanger