Browse Source

修正通知收不到问题

heavyrain lee 5 years ago
parent
commit
8b351314f7

+ 4 - 0
wfchat/WildFireChat/GroupInfoViewController.m

@@ -133,4 +133,8 @@
 }
 */
 
+- (void)dealloc {
+    [[NSNotificationCenter defaultCenter] removeObserver:self];
+}
+
 @end

+ 4 - 0
wfuikit/WFChatUIKit/Channel/WFCUFavChannelTableViewController.m

@@ -158,4 +158,8 @@
     }
 }
 
+
+- (void)dealloc {
+    [[NSNotificationCenter defaultCenter] removeObserver:self];
+}
 @end

+ 9 - 2
wfuikit/WFChatUIKit/CommonVC/WFCUProfileTableViewController.m

@@ -65,8 +65,12 @@
 
 - (void)onUserInfoUpdated:(NSNotification *)notification {
     WFCCUserInfo *userInfo = notification.userInfo[@"userInfo"];
-    if ([[WFCCNetworkService sharedInstance].userId isEqualToString:userInfo.userId]) {
-        [self loadData];
+    if ([self.userId isEqualToString:userInfo.userId]) {
+        dispatch_async(dispatch_get_main_queue(), ^{
+            self.userInfo = userInfo;
+            [self loadData];
+            NSLog(@"reload user info %@", self.userInfo.userId);
+        });
     }
 }
 
@@ -374,4 +378,7 @@
     }
 }
 
+- (void)dealloc {
+    [[NSNotificationCenter defaultCenter] removeObserver:self];
+}
 @end

+ 4 - 0
wfuikit/WFChatUIKit/Contacts/ViewController/WFCUContactListViewController.m

@@ -750,4 +750,8 @@
     return [predicate evaluateWithObject:text];
 }
 
+- (void)dealloc {
+    [[NSNotificationCenter defaultCenter] removeObserver:self];
+}
+
 @end

+ 4 - 0
wfuikit/WFChatUIKit/ConversationSetting/ViewController/WFCUConversationSettingViewController.m

@@ -762,4 +762,8 @@
 //        }
     }
 }
+
+- (void)dealloc {
+    [[NSNotificationCenter defaultCenter] removeObserver:self];
+}
 @end

+ 4 - 0
wfuikit/WFChatUIKit/Group/ViewController/WFCUFavGroupTableViewController.m

@@ -136,4 +136,8 @@
 
     return @[cancel];
 };
+
+- (void)dealloc {
+    [[NSNotificationCenter defaultCenter] removeObserver:self];
+}
 @end

+ 4 - 0
wfuikit/WFChatUIKit/MessageList/Cell/WFCUMediaMessageCell.m

@@ -71,4 +71,8 @@
         }
     }
 }
+
+- (void)dealloc {
+    [[NSNotificationCenter defaultCenter] removeObserver:self];
+}
 @end

+ 4 - 0
wfuikit/WFChatUIKit/Utilities/WFCUMediaMessageDownloader.m

@@ -180,4 +180,8 @@ static WFCUMediaMessageDownloader *sharedSingleton = nil;
     }];
     return YES;
 }
+
+- (void)dealloc {
+    [[NSNotificationCenter defaultCenter] removeObserver:self];
+}
 @end

+ 4 - 0
wfuikit/WFChatUIKit/Vendor/ChatInputBar/WFCUChatInputBar.m

@@ -1017,4 +1017,8 @@
     
     self.textInputView.selectedRange = range;
 }
+
+- (void)dealloc {
+    [[NSNotificationCenter defaultCenter] removeObserver:self];
+}
 @end

+ 3 - 0
wfuikit/WFChatUIKit/Vendor/VideoPlayerKit/VideoPlayerSampleViewController.m

@@ -129,4 +129,7 @@
     }
 }
 
+- (void)dealloc {
+    [[NSNotificationCenter defaultCenter] removeObserver:self];
+}
 @end