瀏覽代碼

1.链接的timer 优化处理

huangxiaodong 11 月之前
父節點
當前提交
e2b20d24c6

+ 2 - 0
创维盒子/双子星云手机/connectDeviceManager/connectDeviceManager.h

@@ -56,6 +56,8 @@ typedef void (^netWork_DidEndByOK) (NSInteger didSuc); // 0 fail 1 suc -1 处理
 //音视频 链接返回-5的时候调用
 - (void)recreateHttpServiceFun;
 
+//链接
+- (void)onConnectFun;
 //断开链接
 - (void)disconnect;
 @end

+ 2 - 2
创维盒子/双子星云手机/connectDeviceManager/connectDeviceManager.m

@@ -289,6 +289,7 @@ static connectDeviceManager *connectDeviceManagerInstance = nil;
     //[self.connectBtn setEnabled:NO];
     //[self.connectBtn setTitle:@"连接中..." forState:UIControlStateDisabled];
     
+    [self.customCheckTimer invalidate];
     self.customCheckTimer = [NSTimer scheduledTimerWithTimeInterval:1 repeats:YES block:^(NSTimer * _Nonnull timer){
     
         if(self->didRuiyunLinkType){
@@ -308,8 +309,7 @@ static connectDeviceManager *connectDeviceManagerInstance = nil;
         
     }];
     
-    [[NSRunLoop currentRunLoop] addTimer:self.customCheckTimer forMode:NSRunLoopCommonModes];
-    [[NSRunLoop currentRunLoop] run];
+    [[NSRunLoop mainRunLoop] addTimer:_customCheckTimer forMode:NSDefaultRunLoopMode];
 }
 
 - (void)disconnect {