UIKit crashes
hanneskaeufler opened this issue · comments
I am getting some crashreports tracing back to the theme change notification which I cannot figure out at all. maybe anyone can see whats wrong just by glancing at what I`m doing?
From the view controller where the crash is happening:
- (void)viewWillAppear:(BOOL)animated
{
[super viewWillAppear:animated];
[NSNotificationCenter.defaultCenter addObserver:self
selector:@selector(applyTheme)
name:nil
object:nil];
// two more method calls ...
[self applyTheme];
}
- (void)viewWillDisappear:(BOOL)animated
{
[super viewWillDisappear:animated];
[NSNotificationCenter.defaultCenter removeObserver:self];
}
The report in crashlytics always shows the applyTheme
method to be root of the crash, with the stacktrace showing a posted notification before.
10 Foundation -[NSNotificationCenter postNotificationName:object:userInfo:] + 72
Fatal Exception: NSInternalInconsistencyException
Tint view duration stack popped without matching push
This is the method:
- (void)applyTheme
{
UIColor *tintColor = [RNThemeManager.sharedManager colorForKey:@"tintColor"];
self.navigationController.navigationBar.barTintColor = tintColor;
self.navigationController.navigationBar.tintColor = [RNThemeManager.sharedManager colorForKey:@"buttonTextColor"];
self.view.tintColor = tintColor;
self.someToolbar.barTintColor = tintColor;
self.someOtherToolbar.barTintColor = tintColor;
}
The theme changing happens in a different view controller than the crash. I cannot reproduce the crash for the life of me. Am I chasing a UIKit bug? Is there something I´m doing wrong? Thanks for any help!