Steven 1 年之前
父節點
當前提交
4de74d8ce7
共有 1 個文件被更改,包括 7 次插入0 次删除
  1. 7 0
      KulexiuForStudent/KulexiuForStudent/AppDelegate.m

+ 7 - 0
KulexiuForStudent/KulexiuForStudent/AppDelegate.m

@@ -423,11 +423,18 @@ didRegisterForRemoteNotificationsWithDeviceToken:(NSData *)deviceToken {
     if (self.isNeedUpdate) {
         [self versionCheck];
     }
+    [self checkConnectionStatus];
 
     // 退到后台发送消息
     [[NSNotificationCenter defaultCenter] postNotificationName:@"appEnterForeground" object:nil];
 }
 
+- (void)checkConnectionStatus {
+    BOOL isConnected = [TXIM_LINSENTER isCurrentUserLoginIM];
+    if (isConnected == NO) { // 连接失败或未连接 需要重新连接
+        [USER_MANAGER checkTokenEnableConnectIM];
+    }
+}
 
 - (void)applicationDidBecomeActive:(UIApplication *)application {
     // app启动或者app从后台进入前台都会调用这个方法