diff --git a/Ifish.xcodeproj/project.pbxproj b/Ifish.xcodeproj/project.pbxproj index 400e6e9..f759c29 100644 --- a/Ifish.xcodeproj/project.pbxproj +++ b/Ifish.xcodeproj/project.pbxproj @@ -15869,7 +15869,7 @@ CODE_SIGN_IDENTITY = "iPhone Developer"; "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; CODE_SIGN_STYLE = Automatic; - CURRENT_PROJECT_VERSION = 1; + CURRENT_PROJECT_VERSION = 3; DEVELOPMENT_TEAM = WFX8GD5HFX; ENABLE_BITCODE = NO; ENABLE_TESTABILITY = YES; @@ -15945,7 +15945,7 @@ "$(PROJECT_DIR)/Ifish/controllers/IfishYooseeFile/IfishYsooseeNewLib/libAVCtrlIOS/libAVCtrl", "$(PROJECT_DIR)/Ifish/controllers/IfishYooseeFile/IfishYsooseeNewLib/libAVCtrl", ); - MARKETING_VERSION = 5.1.20; + MARKETING_VERSION = 5.1.21; ONLY_ACTIVE_ARCH = YES; OTHER_LDFLAGS = ( "-ObjC", @@ -15988,7 +15988,7 @@ CODE_SIGN_IDENTITY = "Apple Development"; "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "Apple Development"; CODE_SIGN_STYLE = Automatic; - CURRENT_PROJECT_VERSION = 1; + CURRENT_PROJECT_VERSION = 3; DEVELOPMENT_TEAM = WFX8GD5HFX; ENABLE_BITCODE = NO; ENABLE_TESTABILITY = YES; @@ -16064,7 +16064,7 @@ "$(PROJECT_DIR)/Ifish/controllers/IfishYooseeFile/IfishYsooseeNewLib/libAVCtrlIOS/libAVCtrl", "$(PROJECT_DIR)/Ifish/controllers/IfishYooseeFile/IfishYsooseeNewLib/libAVCtrl", ); - MARKETING_VERSION = 5.1.20; + MARKETING_VERSION = 5.1.21; ONLY_ACTIVE_ARCH = NO; OTHER_LDFLAGS = ( "-ObjC", diff --git a/Ifish/AppDelegate.m b/Ifish/AppDelegate.m index bd8ebce..c090527 100644 --- a/Ifish/AppDelegate.m +++ b/Ifish/AppDelegate.m @@ -558,7 +558,7 @@ if (kScreenSize.height>480) { // Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state. // Use this method to pause ongoing tasks, disable timers, and throttle down OpenGL ES frame rates. Games should use this method to pause the game. NSLog(@"外部打断"); - [[Socketsingleton sharedInstance] cutOffSocket];//外部应用打断时断开soket 如电话 下拉系统通知栏 上拉系统通知栏短信查看等 + // [[Socketsingleton sharedInstance] cutOffSocket];//外部应用打断时断开soket 如电话 下拉系统通知栏 上拉系统通知栏短信查看等 //摄像头后台模式不能截图 self.isGoBack = YES; // [GWNetSingleton sharedClient] @@ -609,7 +609,7 @@ if (kScreenSize.height>480) { - (void)applicationWillEnterForeground:(UIApplication *)application { - [[Socketsingleton sharedInstance] socketConnectHost]; + // [[Socketsingleton sharedInstance] socketConnectHost]; self.isGoBack = NO; diff --git a/Ifish/Utinitys/SocketSingleton/Socketsingleton.m b/Ifish/Utinitys/SocketSingleton/Socketsingleton.m index ae2ec64..e63ebe7 100644 --- a/Ifish/Utinitys/SocketSingleton/Socketsingleton.m +++ b/Ifish/Utinitys/SocketSingleton/Socketsingleton.m @@ -187,7 +187,7 @@ }else if([string2 isEqualToString:@"00"]&&string1.length==52){ AppDelegate*delegate=(AppDelegate*)[[UIApplication sharedApplication]delegate]; - [delegate.window makeToast:@"设备已离线"]; + // [delegate.window makeToast:@"设备已离线"]; if (self.communiteDelegate) { [self.communiteDelegate ifishDeviceLogInFail]; diff --git a/Ifish/controllers/ConnectAauariumVC/ConnectingAquarVC.m b/Ifish/controllers/ConnectAauariumVC/ConnectingAquarVC.m index a1a0a92..374ac14 100644 --- a/Ifish/controllers/ConnectAauariumVC/ConnectingAquarVC.m +++ b/Ifish/controllers/ConnectAauariumVC/ConnectingAquarVC.m @@ -23,6 +23,7 @@ Strong ESPTouchTask* epTask; Strong NSMutableString *trackString; Strong MBProgressHUD *HUD; Strong NSTimer *timer; +Strong UITapGestureRecognizer*tap; /** 设备返回的mac地址 */ @@ -44,7 +45,10 @@ Copy NSString *deviceId; [self addTitleViewWithTitle:@"尝试与设备建立连接"]; [self.view addSubview:self.progressView]; - + UITapGestureRecognizer*tap=[[UITapGestureRecognizer alloc]initWithTarget:self action:@selector(tryBindAgain:)]; + [self.progressView addGestureRecognizer:tap]; + self.tap=tap; + self.tap.enabled=NO; [self.view addSubview:self.titleL]; [self.titleL mas_makeConstraints:^(MASConstraintMaker *make) { @@ -194,8 +198,8 @@ Copy NSString *deviceId; } failure:^(NSError *err) { - if (self.retryTimes < 3) { - [self bindDeviceWithSsid:self.macAddress]; + if (self.retryTimes < 10) { + [self bindDeviceWithDeviceId:self.deviceId]; self.retryTimes += 1; } else { [self endProgress]; @@ -296,11 +300,7 @@ Copy NSString *deviceId; if (self.macAddress.length == 0) { return; } - self.isBindingDevice = YES; - if (self.bindTimer) { - [self.bindTimer invalidate]; - self.bindTimer = nil; - } + self.retryTimes = 0; if (self.deviceType==DEVICEPETS) { @@ -324,9 +324,9 @@ Copy NSString *deviceId; self.HUD = [MBProgressHUD showHUDAddedTo:self.view animated:YES]; self.HUD.mode = MBProgressHUDModeIndeterminate; self.HUD.labelText = msg; - if ([msg isEqualToString:@"Socket连接失败"]) + if ([msg containsString:@"Socket连接失败"]) { - [self.HUD hide:YES afterDelay:3]; + [self.HUD hide:YES afterDelay:5]; [self endProgress]; [self.progressView endProgressWithString:@"连接失败"]; } @@ -392,8 +392,24 @@ Copy NSString *deviceId; } #pragma mark - bind +-(void)tryBindAgain:(UITapGestureRecognizer*)tap +{ + [self bindDeviceWithSsid:self.macAddress]; +} -(void)bindDeviceWithSsid:(NSString*)bssid{ NSLog(@"设备bssid_%@",bssid); + if (self.isBindingDevice) { + return; + } + else + { + self.isBindingDevice = YES; + if (self.bindTimer) { + [self.bindTimer invalidate]; + self.bindTimer = nil; + } + } + [self appendTrakContent:@"=================进入绑定函数================="]; NSString *userId = [dataContorl dataControlGetUserIdInfo]; @@ -489,13 +505,21 @@ Copy NSString *deviceId; } failure:^(NSError *err) { - if (self.retryTimes < 6) { - [self bindDeviceWithSsid:self.macAddress]; - self.retryTimes += 1; + self.isBindingDevice=NO; + if (self.retryTimes < 10) { + dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(1 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{ + self.HUD.labelText = @"自动重连..."; + [self bindDeviceWithSsid:self.macAddress]; + + self.retryTimes += 1; + + }); } else { - [self endProgress]; + [self endProgress]; + [self.progressView endProgressWithString:@"点击重试"]; + self.tap.enabled=YES; self.isBindingDevice = NO; - self.HUD.labelText = @"请求异常"; + self.HUD.labelText = err.localizedDescription; [self.HUD hide:YES afterDelay:2]; [self appendTrakContent:[NSString stringWithFormat:@"绑定网络请求错误:%@", err.localizedDescription]]; self.bakbutton.userInteractionEnabled=YES; @@ -507,6 +531,7 @@ Copy NSString *deviceId; #pragma mark - Private - (void)appendTrakContent:(NSString *)msg { + NSLog(@"msg=%@",msg); [self.trackString appendString:msg]; [self.trackString appendString:@"\n"]; } diff --git a/Ifish/controllers/IfishTabControllers/我的/mineControllers/pushSetControllrs/AboutUsViewController.m b/Ifish/controllers/IfishTabControllers/我的/mineControllers/pushSetControllrs/AboutUsViewController.m index d11cdc9..a01ca30 100644 --- a/Ifish/controllers/IfishTabControllers/我的/mineControllers/pushSetControllrs/AboutUsViewController.m +++ b/Ifish/controllers/IfishTabControllers/我的/mineControllers/pushSetControllrs/AboutUsViewController.m @@ -25,7 +25,7 @@ // CFShow((__bridge CFTypeRef)(infoDic)); NSString *app_Version=[infoDic objectForKey:@"CFBundleShortVersionString"]; NSLog(@"app_Version%@",app_Version); - app_Version=@"4.7.20"; + app_Version=@"4.7.21"; NSString *versionStr = [NSString stringWithFormat:@"v%@",app_Version]; NSString *buildVersion = [infoDic objectForKey:@"CFBundleVersion"]; if (buildVersion.length > 0) { diff --git a/Ifish/controllers/leftcontrollers/IFishHotpotUDPHelper.m b/Ifish/controllers/leftcontrollers/IFishHotpotUDPHelper.m index 9f2c573..abc2df9 100644 --- a/Ifish/controllers/leftcontrollers/IFishHotpotUDPHelper.m +++ b/Ifish/controllers/leftcontrollers/IFishHotpotUDPHelper.m @@ -49,6 +49,9 @@ NSError *error; //本地接收端口 [self.clientSocket bindToPort:bindPort error:&error]; + if (error) { + [self postmsg: error.localizedDescription]; + } } return self; } @@ -130,7 +133,11 @@ self.tag = 0; [self.clientSocket receiveWithTimeout:-1 tag:self.tag]; - [self.clientSocket sendData:data toHost:hostS port:port withTimeout:-1 tag:self.tag]; + BOOL send= [self.clientSocket sendData:data toHost:hostS port:port withTimeout:-1 tag:self.tag]; + if (!send) + { + [self postmsg:@"发送失败"]; + } } -(BOOL)onUdpSocket:(AsyncUdpSocket *)sock didReceiveData:(NSData *)data withTag:(long)tag fromHost:(NSString *)host port:(UInt16)port @@ -153,26 +160,30 @@ } -(void)onUdpSocketDidClose:(AsyncUdpSocket *)sock{ - NSLog(@"关闭"); + [self postmsg:@"连接关闭"]; } -(void)onUdpSocket:(AsyncUdpSocket *)sock didSendDataWithTag:(long)tag{ NSLog(@"didSendData"); + [self postmsg:@"指令发送"]; + } -(void)onUdpSocket:(AsyncUdpSocket *)sock didNotReceiveDataWithTag:(long)tag dueToError:(NSError *)error{ NSLog(@"dueToError%@",error); - [self postmsg:@"Socket连接失败"]; + [self postmsg:[NSString stringWithFormat:@"Socket连接失败:%@",error.localizedDescription]]; } -(void)dealloc{ + [self postmsg:@"dealloc"]; [self.clientSocket close]; + } - (void)postmsg:(NSString *)msg {