Steven 1 year ago
parent
commit
4de74d8ce7
1 changed files with 7 additions and 0 deletions
  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从后台进入前台都会调用这个方法