Ensure to remove correct notification observer for the style updates.
Looks like notification observers are added for MDCAlertController in mdc_setAdjustsFontForContentSizeCategory: method, but never removed.
On the other hand they seem to be removed for MDCAlertControllerView instead, which doesn't look to observe anything.
MODIFY
components/Dialogs/src/MDCAlertController.m
components/Dialogs/src/MDCAlertController.m
@@ -130,6 +130,10 @@ static NSString *const kMaterialDialogsBundle = @"MaterialDialogs.bundle";
return self;
}
+- (void)dealloc {
+ [[NSNotificationCenter defaultCenter] removeObserver:self];
+}
+
- (void)traitCollectionDidChange:(UITraitCollection *)previousTraitCollection {
[super traitCollectionDidChange:previousTraitCollection];
if (self.traitCollectionDidChangeBlock) {

MODIFY
components/Dialogs/src/private/MDCAlertControllerView+Private.m
components/Dialogs/src/private/MDCAlertControllerView+Private.m
@@ -97,10 +97,6 @@ static const CGFloat MDCDialogMessageOpacity = (CGFloat)0.54;
return self;
}
-- (void)dealloc {
- [[NSNotificationCenter defaultCenter] removeObserver:self];
-}
-
- (NSString *)title {
return self.titleLabel.text;
}

Ensure to remove correct notification observer for the style updates.

Looks like notification observers are added for MDCAlertController in mdc_setAdjustsFontForContentSizeCategory: method, but never removed.
On the other hand they seem to be removed for MDCAlertControllerView instead, which doesn't look to observe anything.

PiperOrigin-RevId: 292010203