瀏覽代碼

修改丢包提示

leon 2 年之前
父節點
當前提交
6ca300f28c
共有 100 個文件被更改,包括 2309 次插入659 次删除
  1. 二進制
      .DS_Store
  2. 二進制
      DanceGame/.DS_Store
  3. 二進制
      DanceGame/Classes/FitfunTool/FitfunSDK_V2.0/KpSupport/.DS_Store
  4. 二進制
      DanceGame/Classes/FitfunTool/FitfunSDK_V2.0/KpSupport/SDK/.DS_Store
  5. 5 2
      DanceGame/Classes/FitfunTool/FitfunSDK_V2.0/KpSupport/SDK/BLE/BTDataAnalysis.mm
  6. 67 48
      DanceGame/Classes/FitfunTool/FitfunSDK_V2.0/KpSupport/SDK/BLE/BTDataProcess.mm
  7. 1 2
      DanceGame/Classes/FitfunTool/FitfunSDK_V2.0/KpSupport/SDK/BLE/LEONBLManager.h
  8. 5 5
      DanceGame/Classes/FitfunTool/FitfunSDK_V2.0/KpSupport/SDK/BLE/LEONBLManager.m
  9. 2 4
      DanceGame/Classes/FitfunTool/FitfunSDK_V2.0/KpSupport/SDK/Entity /UserFriendsModel.h
  10. 3 7
      DanceGame/Classes/FitfunTool/FitfunSDK_V2.0/KpSupport/SDK/HTTP/HTTPDataProcession.h
  11. 6 5
      DanceGame/Classes/FitfunTool/FitfunSDK_V2.0/KpSupport/SDK/HTTP/HTTPDataProcession.m
  12. 0 1
      DanceGame/Classes/FitfunTool/FitfunSDK_V2.0/KpSupport/SDK/IOSPlatformSDK.mm
  13. 二進制
      DanceGame/Classes/FitfunTool/FitfunSDK_V2.0/KpSupport/SDK/ThirdClass/.DS_Store
  14. 0 0
      DanceGame/Classes/FitfunTool/FitfunSDK_V2.0/KpSupport/SDK/ThirdClass/AFNetworking/AFCompatibilityMacros.h
  15. 0 0
      DanceGame/Classes/FitfunTool/FitfunSDK_V2.0/KpSupport/SDK/ThirdClass/AFNetworking/AFHTTPSessionManager.h
  16. 0 0
      DanceGame/Classes/FitfunTool/FitfunSDK_V2.0/KpSupport/SDK/ThirdClass/AFNetworking/AFHTTPSessionManager.m
  17. 0 0
      DanceGame/Classes/FitfunTool/FitfunSDK_V2.0/KpSupport/SDK/ThirdClass/AFNetworking/AFNetworkReachabilityManager.h
  18. 0 0
      DanceGame/Classes/FitfunTool/FitfunSDK_V2.0/KpSupport/SDK/ThirdClass/AFNetworking/AFNetworkReachabilityManager.m
  19. 0 0
      DanceGame/Classes/FitfunTool/FitfunSDK_V2.0/KpSupport/SDK/ThirdClass/AFNetworking/AFNetworking.h
  20. 0 0
      DanceGame/Classes/FitfunTool/FitfunSDK_V2.0/KpSupport/SDK/ThirdClass/AFNetworking/AFSecurityPolicy.h
  21. 0 0
      DanceGame/Classes/FitfunTool/FitfunSDK_V2.0/KpSupport/SDK/ThirdClass/AFNetworking/AFSecurityPolicy.m
  22. 0 0
      DanceGame/Classes/FitfunTool/FitfunSDK_V2.0/KpSupport/SDK/ThirdClass/AFNetworking/AFURLRequestSerialization.h
  23. 0 0
      DanceGame/Classes/FitfunTool/FitfunSDK_V2.0/KpSupport/SDK/ThirdClass/AFNetworking/AFURLRequestSerialization.m
  24. 0 0
      DanceGame/Classes/FitfunTool/FitfunSDK_V2.0/KpSupport/SDK/ThirdClass/AFNetworking/AFURLResponseSerialization.h
  25. 0 0
      DanceGame/Classes/FitfunTool/FitfunSDK_V2.0/KpSupport/SDK/ThirdClass/AFNetworking/AFURLResponseSerialization.m
  26. 0 0
      DanceGame/Classes/FitfunTool/FitfunSDK_V2.0/KpSupport/SDK/ThirdClass/AFNetworking/AFURLSessionManager.h
  27. 0 0
      DanceGame/Classes/FitfunTool/FitfunSDK_V2.0/KpSupport/SDK/ThirdClass/AFNetworking/AFURLSessionManager.m
  28. 二進制
      DanceGame/Classes/FitfunTool/FitfunSDK_V2.0/KpSupport/SDK/ThirdClass/AvoidCrash-master/.DS_Store
  29. 二進制
      DanceGame/Classes/FitfunTool/FitfunSDK_V2.0/KpSupport/SDK/ThirdClass/Bugly-2.5.9/.DS_Store
  30. 0 0
      DanceGame/Classes/FitfunTool/FitfunSDK_V2.0/KpSupport/SDK/ThirdClass/socket/SRWebSocket.h
  31. 0 0
      DanceGame/Classes/FitfunTool/FitfunSDK_V2.0/KpSupport/SDK/ThirdClass/socket/SRWebSocket.m
  32. 0 0
      DanceGame/Classes/FitfunTool/FitfunSDK_V2.0/KpSupport/SDK/ThirdClass/socket/SocketRocketUtility.h
  33. 0 0
      DanceGame/Classes/FitfunTool/FitfunSDK_V2.0/KpSupport/SDK/ThirdClass/socket/SocketRocketUtility.m
  34. 5 3
      DanceGame/Classes/FitfunTool/FitfunSDK_V2.0/KpSupport/SDK/Tool/AlgorithmTool.m
  35. 4 2
      DanceGame/Classes/FitfunTool/FitfunSDK_V2.0/KpSupport/SDK/Tool/BugTool.m
  36. 0 19
      DanceGame/Classes/FitfunTool/FitfunSDK_V2.0/KpSupport/SDK/Tool/DebugTool.h
  37. 0 71
      DanceGame/Classes/FitfunTool/FitfunSDK_V2.0/KpSupport/SDK/Tool/DebugTool.m
  38. 二進制
      DanceGame/Classes/FitfunTool/FitfunSDK_V2.0/KpSupport/SDK/UI/.DS_Store
  39. 6 6
      DanceGame/Classes/FitfunTool/FitfunSDK_V2.0/KpSupport/SDK/UI/DebugView.h
  40. 79 3
      DanceGame/Classes/FitfunTool/FitfunSDK_V2.0/KpSupport/SDK/UI/DebugView.m
  41. 二進制
      DanceGame/Classes/FitfunTool/FitfunSDK_V2.0/KpSupport/SDK/resources /.DS_Store
  42. 二進制
      DanceGame/Classes/FitfunTool/FitfunSDK_V2.0/KpSupport/SDK/shoe_sdk_c/shoes_sdk_2.0/.DS_Store
  43. 23 29
      DanceGame/Unity-iPhone.xcodeproj/project.pbxproj
  44. 二進制
      DanceGame/Unity-iPhone.xcodeproj/project.xcworkspace/xcuserdata/duowan123.xcuserdatad/UserInterfaceState.xcuserstate
  45. 二進制
      RunGame/.DS_Store
  46. 二進制
      RunGame/SDK/.DS_Store
  47. 4 2
      RunGame/SDK/BLE/BTDataAnalysis.mm
  48. 2 16
      RunGame/SDK/BLE/BTDataProcess.h
  49. 268 356
      RunGame/SDK/BLE/BTDataProcess.mm
  50. 2 2
      RunGame/SDK/BLE/LEONBLManager.h
  51. 6 6
      RunGame/SDK/BLE/LEONBLManager.m
  52. 0 23
      RunGame/SDK/BLE/MotionCountObj.h
  53. 0 12
      RunGame/SDK/BLE/MotionCountObj.m
  54. 63 0
      RunGame/SDK/Entity /GameInfo.h
  55. 12 0
      RunGame/SDK/Entity /GameInfo.m
  56. 33 0
      RunGame/SDK/Entity /ShoesInfo.h
  57. 12 0
      RunGame/SDK/Entity /ShoesInfo.m
  58. 2 4
      RunGame/SDK/Entity /UserFriendsModel.h
  59. 3 7
      RunGame/SDK/HTTP/HTTPDataProcession.h
  60. 7 14
      RunGame/SDK/HTTP/HTTPDataProcession.m
  61. 2 6
      RunGame/SDK/IOSPlatformSDK.h
  62. 4 4
      RunGame/SDK/IOSPlatformSDK.mm
  63. 二進制
      RunGame/SDK/ThirdClass/.DS_Store
  64. 0 0
      RunGame/SDK/ThirdClass/AFNetworking/AFCompatibilityMacros.h
  65. 0 0
      RunGame/SDK/ThirdClass/AFNetworking/AFHTTPSessionManager.h
  66. 0 0
      RunGame/SDK/ThirdClass/AFNetworking/AFHTTPSessionManager.m
  67. 0 0
      RunGame/SDK/ThirdClass/AFNetworking/AFNetworkReachabilityManager.h
  68. 0 0
      RunGame/SDK/ThirdClass/AFNetworking/AFNetworkReachabilityManager.m
  69. 0 0
      RunGame/SDK/ThirdClass/AFNetworking/AFNetworking.h
  70. 0 0
      RunGame/SDK/ThirdClass/AFNetworking/AFSecurityPolicy.h
  71. 0 0
      RunGame/SDK/ThirdClass/AFNetworking/AFSecurityPolicy.m
  72. 0 0
      RunGame/SDK/ThirdClass/AFNetworking/AFURLRequestSerialization.h
  73. 0 0
      RunGame/SDK/ThirdClass/AFNetworking/AFURLRequestSerialization.m
  74. 0 0
      RunGame/SDK/ThirdClass/AFNetworking/AFURLResponseSerialization.h
  75. 0 0
      RunGame/SDK/ThirdClass/AFNetworking/AFURLResponseSerialization.m
  76. 0 0
      RunGame/SDK/ThirdClass/AFNetworking/AFURLSessionManager.h
  77. 0 0
      RunGame/SDK/ThirdClass/AFNetworking/AFURLSessionManager.m
  78. 二進制
      RunGame/SDK/ThirdClass/AvoidCrash-master/.DS_Store
  79. 二進制
      RunGame/SDK/ThirdClass/AvoidCrash-master/AvoidCrashDemo/.DS_Store
  80. 116 0
      RunGame/SDK/ThirdClass/AvoidCrash/AvoidCrash.h
  81. 220 0
      RunGame/SDK/ThirdClass/AvoidCrash/AvoidCrash.m
  82. 17 0
      RunGame/SDK/ThirdClass/AvoidCrash/AvoidCrashProtocol.h
  83. 37 0
      RunGame/SDK/ThirdClass/AvoidCrash/AvoidCrashStubProxy.h
  84. 18 0
      RunGame/SDK/ThirdClass/AvoidCrash/AvoidCrashStubProxy.m
  85. 25 0
      RunGame/SDK/ThirdClass/AvoidCrash/NSArray+AvoidCrash.h
  86. 258 0
      RunGame/SDK/ThirdClass/AvoidCrash/NSArray+AvoidCrash.m
  87. 25 0
      RunGame/SDK/ThirdClass/AvoidCrash/NSAttributedString+AvoidCrash.h
  88. 96 0
      RunGame/SDK/ThirdClass/AvoidCrash/NSAttributedString+AvoidCrash.m
  89. 24 0
      RunGame/SDK/ThirdClass/AvoidCrash/NSDictionary+AvoidCrash.h
  90. 56 0
      RunGame/SDK/ThirdClass/AvoidCrash/NSDictionary+AvoidCrash.m
  91. 26 0
      RunGame/SDK/ThirdClass/AvoidCrash/NSMutableArray+AvoidCrash.h
  92. 169 0
      RunGame/SDK/ThirdClass/AvoidCrash/NSMutableArray+AvoidCrash.m
  93. 23 0
      RunGame/SDK/ThirdClass/AvoidCrash/NSMutableAttributedString+AvoidCrash.h
  94. 74 0
      RunGame/SDK/ThirdClass/AvoidCrash/NSMutableAttributedString+AvoidCrash.m
  95. 24 0
      RunGame/SDK/ThirdClass/AvoidCrash/NSMutableDictionary+AvoidCrash.h
  96. 95 0
      RunGame/SDK/ThirdClass/AvoidCrash/NSMutableDictionary+AvoidCrash.m
  97. 29 0
      RunGame/SDK/ThirdClass/AvoidCrash/NSMutableString+AvoidCrash.h
  98. 97 0
      RunGame/SDK/ThirdClass/AvoidCrash/NSMutableString+AvoidCrash.m
  99. 34 0
      RunGame/SDK/ThirdClass/AvoidCrash/NSObject+AvoidCrash.h
  100. 220 0
      RunGame/SDK/ThirdClass/AvoidCrash/NSObject+AvoidCrash.m

二進制
.DS_Store


二進制
DanceGame/.DS_Store


二進制
DanceGame/Classes/FitfunTool/FitfunSDK_V2.0/KpSupport/.DS_Store


二進制
DanceGame/Classes/FitfunTool/FitfunSDK_V2.0/KpSupport/SDK/.DS_Store


+ 5 - 2
DanceGame/Classes/FitfunTool/FitfunSDK_V2.0/KpSupport/SDK/BLE/BTDataAnalysis.mm

@@ -100,11 +100,14 @@
 //
 //        }else if (dataType == -95 && characteristic.length == 26){//获取的是查询的数据 char-->int a1 = -95
            //A1+1 >> 1: 设备数据(左鞋,右鞋)  aa 14 eb a1 01 64 00 1a 0000981d 64 00 17 00000000 f9
+    
+//        NSLog(@"主设备 读取特征的报文 硬件信息 %ld dataType = -95 %@ %ld",(long)deviceType,characteristic,characteristic.length);
+    
                 int leftElectricity = [AlgorithmTool dataToInt:[characteristic subdataWithRange:NSMakeRange(5, 1)]];
                 int rightElectricity = [AlgorithmTool dataToInt:[characteristic subdataWithRange:NSMakeRange(15, 1)]];//龙哥新协议
                 
                 if (deviceType==DEVICETYPE_MAIN && LEManager.peripheral!=nil){//主设备
-                    NSLog(@"主设备 接收到 鞋子硬件数据 data 26 = %@  电量 %d %d %@ %@",characteristic,leftElectricity,rightElectricity,LEManager.peripheral.name,LEManager.peripheral.identifier.UUIDString);
+//                    NSLog(@"主设备 接收到 鞋子硬件数据: %@  电量 %d %d %@ %@",characteristic,leftElectricity,rightElectricity,LEManager.peripheral.name,LEManager.peripheral.identifier.UUIDString);
                     //主 设备定时器 60秒调一次   /******************ios call unity*****************/
                      [[IOSPlatformSDK sharedInstance] bridgingDeviceAction:DEVICETYPE_MAIN
                                                  name:LEManager.peripheral.name
@@ -113,7 +116,7 @@
                                           electricity:leftElectricity<=rightElectricity?leftElectricity:rightElectricity];
              
                 }else if (deviceType==DEVICETYPE_VICE && LEManager.vicePeripheral!=nil){//副设备
-                    NSLog(@"副设备 接收到 鞋子硬件数据 26 = %@  电量 %d %d",characteristic,leftElectricity,rightElectricity);
+//                    NSLog(@"副设备 接收到 鞋子硬件数据: %@  电量 %d %d",characteristic,leftElectricity,rightElectricity);
                     //副 设备定时器 60秒调一次   /******************ios call unity*****************/
                      [[IOSPlatformSDK sharedInstance] bridgingDeviceAction:DEVICETYPE_VICE
                                                  name:LEManager.vicePeripheral.name

+ 67 - 48
DanceGame/Classes/FitfunTool/FitfunSDK_V2.0/KpSupport/SDK/BLE/BTDataProcess.mm

@@ -13,7 +13,6 @@
 
 #import "ShoesInfo.h"
 #import "GameInfo.h"
-#import "DebugTool.h"
 #import "CacheTool.h"
 
 //#define NSLog(format, ...) printf("TIME:%s FILE:%s(%d行) FUNCTION:%s %s\n",__TIME__, [[[NSString stringWithUTF8String:__FILE__] lastPathComponent] UTF8String], __LINE__, __PRETTY_FUNCTION__, [[NSString stringWithFormat:(format), ##__VA_ARGS__] UTF8String])
@@ -179,6 +178,9 @@ void inviteFriends (CFNotificationCenterRef center, void *observer, CFStringRef
     //链接蓝牙
     [self initCBCentralManager];
     
+    //链接动画
+    [[AnimationView shanreAnimationView] addAnimation];
+    
 }
 
 //unity call instance弹出蓝牙搜索框
@@ -199,6 +201,8 @@ void inviteFriends (CFNotificationCenterRef center, void *observer, CFStringRef
         weakself.game_info.deviceType = (DEVICE_TYPE)type;
         weakself.shoes_info.macAddress = peripheral.identifier.UUIDString;
         [weakself connectPeripheral:peripheral];
+        //链接动画
+        [[AnimationView shanreAnimationView] addAnimation];
     };
     
 }
@@ -213,7 +217,7 @@ void inviteFriends (CFNotificationCenterRef center, void *observer, CFStringRef
     self.shoes_info.gameModel = YES;
     //读写到特征后 添加测试弹窗
     dispatch_async(dispatch_get_main_queue(), ^{
-        [DebugViewInstance inittestLabel];
+        [DebugViewInstance initTestLabel];
     });
     
 }
@@ -237,10 +241,6 @@ void inviteFriends (CFNotificationCenterRef center, void *observer, CFStringRef
 //测试自己封装的蓝牙类
 -(void)initCBCentralManager{
     
-    //建立socket链接
-    SocketRocketUtility * install = [SocketRocketUtility sharedInstance];
-    [install SRWebSocketOpen];
-
     if (LEManager.centralManager == nil && LEManager.peripheral == nil && LEManager.vicePeripheral == nil){
         [LEManager initCBCentralManager];
         NSLog(@" ====================>> 未初始化 centralManager 直接开始初始化");
@@ -354,10 +354,18 @@ void inviteFriends (CFNotificationCenterRef center, void *observer, CFStringRef
     
     if(instance!=NULL && peripheral!=NULL){
        
-        self.sdk = [IOSPlatformSDK sharedInstance];//蓝牙数据经过sdk数据转换后 ios call unity
-        DebugViewInstance.currentTS = 1000;
         NSLog(@"BTDataProcess connectPeripheral self.game_info.deviceType ==>> %ld  self.game_info.game_type ==>> %d   mac ==>>  %@",(long)self.game_info.deviceType,self.game_info.game_type,self.shoes_info.macAddress);
         
+        //蓝牙数据经过sdk数据转换后 ios call unity
+        self.sdk = [IOSPlatformSDK sharedInstance];
+
+        //建立socket链接
+        SocketRocketUtility * install = [SocketRocketUtility sharedInstance];
+        [install SRWebSocketOpen];
+        
+        //初始化实时时间戳
+        DebugViewInstance.currentTS = -1;
+        
         //初始化运轨sdk
         if (self.game_info.deviceType==DEVICETYPE_MAIN){
             LEManager.peripheral = peripheral;
@@ -376,11 +384,10 @@ void inviteFriends (CFNotificationCenterRef center, void *observer, CFStringRef
 
 //链接主副设备 + 绑定特征
 -(void)connectBLEManagerData:(CBPeripheral*)peripheral deviceType:(DEVICE_TYPE)deviceType{
+    
         
     //链接蓝牙 此时 LEManager.peripheral || LEManager.vicePeripheral 还未init
     [LEManager connectPeripheral:peripheral options:nil];
-    //链接动画
-    [[AnimationView shanreAnimationView] addAnimation];
     
     //蓝牙连接成功
     LEManager.successfulBlock = ^(CBPeripheral * _Nonnull peripheral){
@@ -458,9 +465,10 @@ void inviteFriends (CFNotificationCenterRef center, void *observer, CFStringRef
     
     //读取特征的报文数据
     LEManager.readValueForCharacteristicBlock = ^(CBPeripheral * _Nonnull peripheral, CBCharacteristic * _Nonnull characteristic, NSData * _Nonnull value, NSError * _Nonnull error, DEVICE_TYPE type){
-        if ([characteristic.UUID.UUIDString isEqualToString:@"6E400003-B5A3-F393-E0A9-E50E24DCCA9E"]){//判断是不是我们设备的特征值
-//            NSLog(@"characteristic.UUID.UUIDString = %@",characteristic.UUID.UUIDString);
+        //            NSLog(@"characteristic.UUID.UUIDString = %@",characteristic.UUID.UUIDString);
+//        NSLog(@"characteristic.value = %@",characteristic.value);
 
+        if ([characteristic.UUID.UUIDString isEqualToString:@"6E400003-B5A3-F393-E0A9-E50E24DCCA9E"]){//判断是不是我们设备的特征值
             //每收到数据包读取一次蓝牙RSSI 无论1秒内请求多少次rssi值,原生api每秒都最多返回一次RSSI
             [peripheral readRSSI];
             
@@ -468,25 +476,36 @@ void inviteFriends (CFNotificationCenterRef center, void *observer, CFStringRef
             if ([AlgorithmTool verificationRusult:characteristic.value]==YES){
                 
                 int dataType = [AlgorithmTool dataToChar:[characteristic.value subdataWithRange:NSMakeRange(3, 1)]];//cmd类型
-//                NSLog(@"读取特征的报文 游戏数据 %ld dataType = %d %@",(long)type,dataType,characteristic.value);
+//                char dataType_char = [AlgorithmTool dataToChar:[characteristic.value subdataWithRange:NSMakeRange(3, 1)]];//cmd类型
+                
                   if (dataType == 4){//鞋子游戏数据
                       
+                          if (characteristic.value.length < 64){
+                              return;
+                          }
+                      
+                          //成功打开游戏模式 隐藏加载框
+                          [[AnimationView shanreAnimationView] stopAnimation];
+
                           //数据丢给算法计算轨迹
                           if (type == DEVICETYPE_MAIN&&LEManager.main_read == 0){
 //                              NSLog(@"LEManager.main_read = %d",LEManager.main_read);
+//                              NSLog(@"主设备 读取特征的报文 游戏数据 %ld dataType = %d %@",(long)type,dataType,characteristic.value);
                               LEManager.main_read = 1;
                               [self shoseSDK:characteristic.value];
                           }else if (type == DEVICETYPE_VICE&&LEManager.vice_read == 0){
 //                              NSLog(@"LEManager.vice_read = %d",LEManager.main_read);
+//                              NSLog(@"副设备 读取特征的报文 游戏数据 %ld dataType = %d %@",(long)type,dataType,characteristic.value);
                               LEManager.vice_read = 1;
                               [self viceShoseSDK:characteristic.value];
                           }
                       
                   }else if(dataType == -95){//鞋子状态信息
                       
-                          //隐藏加载框
-                          [[AnimationView shanreAnimationView] stopAnimation];
-
+                          if (characteristic.value.length<30){
+                              return;
+                          }
+                      
                           //嵌入式原始数据解析 --->> 回调蓝牙状态/电量给unity
                           BTDataAnalysis * anly = [BTDataAnalysis new];
                           [anly analysisCharacteristic:characteristic.value deviceType:type];
@@ -505,7 +524,7 @@ void inviteFriends (CFNotificationCenterRef center, void *observer, CFStringRef
     
     //蓝牙更新RSSI
     LEManager.rssiBlock = ^(NSNumber * _Nonnull RSSI){
-        DebugViewInstance.RSSI = RSSI;
+        LEManager.RSSI = RSSI;
 //        NSLog(@"self.RSSI  = %@",self.RSSI);
     };
     
@@ -544,17 +563,18 @@ void inviteFriends (CFNotificationCenterRef center, void *observer, CFStringRef
 #pragma mark ===============================================>> 主设备 报文数据解析后 -- 调用蓝牙鞋子SDK装换数据 -- ios call unity 更新游戏动作
 -(void)shoseSDK:(NSData*)characteristic{
         
+//    NSLog(@"characteristic = %@",characteristic);
+
         if (self.shoes_info.gameModel==YES){//当前是游戏模式
             
             /********************初始化 运动轨迹算法 SDK *****************/
-        //    NSLog(@"characteristic = %@",characteristic);
             NSData * validData= [characteristic subdataWithRange:NSMakeRange(4, characteristic.length-4)];
             Byte * buff = (Byte*)[validData bytes];
             game->GameProcessBuf(buff, (int)validData.length);
             
             /********************剑波 & 威严 要的图表数据 *****************/
             NSString * message = [NSString stringWithUTF8String:game->getGameDataStr().c_str()];
-            [DebugTool debugMessage:message shoesInfo:self.shoes_info];
+            [DebugViewInstance debugMessage:message shoesInfo:self.shoes_info];
             
             /******************左右脚动作数据处理 + 回调*****************/
             int length = 4;
@@ -584,35 +604,35 @@ void inviteFriends (CFNotificationCenterRef center, void *observer, CFStringRef
 //                    NSLog(@" 主设备 =================================== 蹲下去 ");
                 }
                 
-            /******************当局鞋子子动作状态数据 缓存*****************/
-            self.shoes_info.leftStepStatus =  game->getStepStatus(LEFT_FOOT);
-            self.shoes_info.leftStepFreq =  game->getStepFreq(LEFT_FOOT);
-            self.shoes_info.leftStepCount =  game->getStepCount(LEFT_FOOT);
-            self.shoes_info.rightStepStatus =  game->getStepStatus(RIGHT_FOOT);
-            self.shoes_info.rightStepFreq =  game->getStepFreq(RIGHT_FOOT);
-            self.shoes_info.rightStepCount =  game->getStepCount(RIGHT_FOOT);
-            [self cacheAllMotionCount];
+                /******************当局鞋子子动作状态数据 缓存*****************/
+                self.shoes_info.leftStepStatus =  game->getStepStatus(LEFT_FOOT);
+                self.shoes_info.leftStepFreq =  game->getStepFreq(LEFT_FOOT);
+                self.shoes_info.leftStepCount =  game->getStepCount(LEFT_FOOT);
+                self.shoes_info.rightStepStatus =  game->getStepStatus(RIGHT_FOOT);
+                self.shoes_info.rightStepFreq =  game->getStepFreq(RIGHT_FOOT);
+                self.shoes_info.rightStepCount =  game->getStepCount(RIGHT_FOOT);
+                [self cacheAllMotionCount];
+                    
+                /******************鞋子动作状态数据 实时回调*****************/
+                //左右脚动作:所有游戏都需要回调
+                [self.sdk bridgingMotionAction:DEVICETYPE_MAIN left:motionLeft right:motionRight];
                 
-            /******************鞋子动作状态数据 实时回调*****************/
-            //左右脚动作
-            [self.sdk bridgingMotionAction:DEVICETYPE_MAIN left:motionLeft right:motionRight];
-            
-            //只有 跑酷 需要回调步频
-            if (self.game_info.game_type == GAME_TYPE_RUN){
-                [self.sdk bridgingStepAction:DEVICETYPE_MAIN leftStatus:self.shoes_info.leftStepStatus rightStatus:self.shoes_info.rightStepStatus leftFrag:self.shoes_info.leftStepFreq rightFrag:self.shoes_info.rightStepFreq];
-            }
-            
-//            //只有 赛车游戏 需要回调当前朝向
-//            if (self.game_info.game_type == GAME_TYPE_CYCLE){
-//                    int attLength = 3;
-//                    int left[attLength];
-//                    int right[attLength];
-//                     game->getFootAtt(left, right);
-//                    self.nativeAttX = left[0];
-//                    NSLog(@"self.nativeAttX = %d",self.nativeAttX);
-//            }
+                //步频状态:只有跑酷回调
+                if (self.game_info.game_type == GAME_TYPE_RUN){
+                    [self.sdk bridgingStepAction:DEVICETYPE_MAIN leftStatus:self.shoes_info.leftStepStatus rightStatus:self.shoes_info.rightStepStatus leftFrag:self.shoes_info.leftStepFreq rightFrag:self.shoes_info.rightStepFreq];
+                }
                 
-         }
+                //人物朝向 只有 三轮车 需要
+                if (self.game_info.game_type == GAME_TYPE_CYCLE){
+                        int attLength = 3;
+                        int left[attLength];
+                        int right[attLength];
+                         game->getFootAtt(left, right);
+                        self.nativeAttX = left[0];
+                        NSLog(@"self.nativeAttX = %d",self.nativeAttX);
+                }
+                
+           }
      
         }else{//当前是交互模式
 
@@ -627,7 +647,6 @@ void inviteFriends (CFNotificationCenterRef center, void *observer, CFStringRef
 //            }else{
 //    //            NSLog(@"BTDataProcess 无效交互动作 ===>> %@",@"原地");
 //            }
-            
         }
     
 }
@@ -696,7 +715,7 @@ void inviteFriends (CFNotificationCenterRef center, void *observer, CFStringRef
     return _deviceArray;;
 }
 
-#pragma mark ===============================================>>玩游戏过程中缓存 动作数据 和时间戳 数据存入plist
+#pragma mark ===============================================>> 玩游戏过程中缓存 动作数据 和时间戳 数据存入plist
 -(void)cacheAllMotionCount{
     
     //总数

+ 1 - 2
DanceGame/Classes/FitfunTool/FitfunSDK_V2.0/KpSupport/SDK/BLE/LEONBLManager.h

@@ -83,13 +83,12 @@ typedef void(^RSSIBlock)(NSNumber *RSSI);
 @property(assign,nonatomic)int vice_read;
 
 /**测试参数start*/
-//临时的时间戳
 @property(assign,nonatomic)int totalPackages;
 @property(assign,nonatomic)int totalLoss;
 @property(assign,nonatomic)int tempTs;
+@property(nonatomic,assign) NSNumber *RSSI;//设备到手机的实时信号强度
 /**测试参数end*/
 
-
 /**
  声明单例类
  */

+ 5 - 5
DanceGame/Classes/FitfunTool/FitfunSDK_V2.0/KpSupport/SDK/BLE/LEONBLManager.m

@@ -296,23 +296,23 @@ static LEONBLManager * instance;
         if (peripheral == weakself.peripheral){
             
             if (characteristic.value.length >60){
-                
+
                 weakself.main_read = 0;
 
                 int newTs = [AlgorithmTool dataToChar:[characteristic.value subdataWithRange:NSMakeRange(54, 1)]];;//ts 时间戳
-                
+
                 self.totalPackages++;
                 int total_loss = self.tempTs - abs(newTs);
                 int abs_loss = abs(total_loss);
 //                NSLog(@"收到主设备 推送的报文 时间戳 ================ >>%d %d 【%d - %d = %d】",self.totalPackages,newTs,self.tempTs,abs(newTs),abs_loss);
-                
+
                 if (abs_loss>2){
                 self.totalLoss = self.totalLoss+(abs_loss/2-1);
 //                NSLog(@"系统api丢包 ===================================================================== >> %d %d/%d",abs_loss/2-1,self.totalLoss,self.totalPackages);
                 }
-                
+
                 self.tempTs = abs(newTs);
-                
+
             }
             
             _readValueForCharacteristicBlock(weakself.peripheral,characteristic,data,error,DEVICETYPE_MAIN);

+ 2 - 4
DanceGame/Classes/FitfunTool/FitfunSDK_V2.0/KpSupport/SDK/Entity /UserFriendsModel.h

@@ -10,9 +10,9 @@
 
 @interface UserFriendsModel : NSObject
 
-@property (nonatomic, assign) int code;    //为0
+@property (nonatomic, assign) int code;//为0
 
-@property (nonatomic, assign) int trans_id;    //业务id,避免关键字转换成非关键字
+@property (nonatomic, assign) int trans_id;//业务id,避免关键字转换成非关键字
 @property (nonatomic, assign) NSString * nickname;
 @property (nonatomic, assign) NSString * avatar;
 @property (nonatomic, assign) int  gender;
@@ -49,6 +49,4 @@
 
 @property (nonatomic, assign) int  position;
 
-
-
 @end

+ 3 - 7
DanceGame/Classes/FitfunTool/FitfunSDK_V2.0/KpSupport/SDK/HTTP/HTTPDataProcession.h

@@ -17,13 +17,6 @@
 
 //#define BASE_URL @"http://shoes-api.hiyd.com"//正式环境
 #define BASE_URL @"http://test-shoes-api.hiyd.com"//测试环境
-//#define GAME_INVITE [NSString stringWithFormat:@"%@%@",BASE_URL,@"/game/invite"]
-//#define GAME_RECORD [NSString stringWithFormat:@"%@%@",BASE_URL,@"/gameRecord/addGame"]
-//#define GAME_FRIENDS [NSString stringWithFormat:@"%@%@",BASE_URL,@"/forum/friends"]
-//#define GAME_RANK [NSString stringWithFormat:@"%@%@",BASE_URL,@"/rank/game"]
-//#define GAME_START [NSString stringWithFormat:@"%@%@",BASE_URL,@"/game/start"]
-//#define GAME_END [NSString stringWithFormat:@"%@%@",BASE_URL,@"/game/end"]
-
 #define GAME_INVITE [NSString stringWithFormat:@"%@%@?v=%@&os=%@",BASE_URL,@"/game/invite",CFBundleVersion,OS]
 #define GAME_RECORD [NSString stringWithFormat:@"%@%@?v=%@&os=%@",BASE_URL,@"/gameRecord/addGame",CFBundleVersion,OS]
 #define GAME_FRIENDS [NSString stringWithFormat:@"%@%@?v=%@&os=%@",BASE_URL,@"/forum/friends",CFBundleVersion,OS]
@@ -52,18 +45,21 @@ typedef void(^GameEndDataBlock)(NSString * jsonString);//游戏结束
 */
 + (void)inviteFriends:(int)friendid info:(char*)info inviteDataBlock:(InviteDataBlock)inviteDataBlock;
 
+
 /**
 获取好友榜单数据
  @param type if (type == 0) "world" else "friend"
 */
 + (void)GetRank:(int)type rankDataBlock:(RankDataBlock)rankDataBlock;
 
+
 /**
  获取好友列表
  @param type if (type == 0) "world" else "friend"
 */
 +(void)getFriendsList:(UserFriendsDataBlock)userFriendsDataBlock;
 
+
 /**
   上传游戏数据
  @param level 等级

+ 6 - 5
DanceGame/Classes/FitfunTool/FitfunSDK_V2.0/KpSupport/SDK/HTTP/HTTPDataProcession.m

@@ -14,7 +14,6 @@
 @implementation HTTPDataProcession
 
 #pragma mark - 网络请求数据
-/// 向网络请求数据
 + (void)getHTTPDataProcession:(NSString*)urlString token:(NSString*)token success:(SuccessBlock)successBlock fail:(FailBlock)failBlock{
     
     // 1.创建url
@@ -67,7 +66,6 @@
     
 }
 
-/// 向网络请求数据
 + (void)postHTTPDataProcession:(NSString *)urlString  withParams:(NSDictionary *)params token:(NSString*)token success:(SuccessBlock)successBlock fail:(FailBlock)failBlock{
     
       NSURL *url = [NSURL URLWithString:urlString];
@@ -114,7 +112,7 @@
         
 }
 
-//
+//字典转json字符串
 +(NSString*)getKeyValueStringWithDictionary:(NSDictionary*)dic{
     
     if (!dic||dic.count==0){
@@ -213,6 +211,7 @@
     
 }
 
+//邀请好友
 + (void)inviteFriends:(int)friendid info:(char*)info inviteDataBlock:(InviteDataBlock)inviteDataBlock{
     
     NSString * invite_user_id = [NSString stringWithFormat:@"%d",friendid];
@@ -245,6 +244,7 @@
     
 }
 
+//获取排行榜
 + (void)GetRank:(int)type rankDataBlock:(RankDataBlock)rankDataBlock{
 
     NSString * scoreType;
@@ -346,7 +346,6 @@
 
 /**
  开始游戏
- @param level 等级
 */
 +(void)gameStart{
 
@@ -380,7 +379,6 @@
 
 /**
  结束游戏
- @param level 等级
 */
 +(void)gameEnd{
     
@@ -411,6 +409,9 @@
     
 }
 
+/**
+ 上传运动数据
+*/
 +(void)postGameRecord:(int)level
                 score:(double)score
                record:(int)record

+ 0 - 1
DanceGame/Classes/FitfunTool/FitfunSDK_V2.0/KpSupport/SDK/IOSPlatformSDK.mm

@@ -111,7 +111,6 @@ static IOSPlatformSDK * instance;
 #pragma mark ============================>> public method app 跳转直链
 -(void)startWithUrl:(NSURL*)url{
     [BTDataInstance startWithUrl:url];
-    
 }
 
 //

二進制
DanceGame/Classes/FitfunTool/FitfunSDK_V2.0/KpSupport/SDK/ThirdClass/.DS_Store


+ 0 - 0
RunGame/SDK/HTTP/AFNetworking/AFCompatibilityMacros.h → DanceGame/Classes/FitfunTool/FitfunSDK_V2.0/KpSupport/SDK/ThirdClass/AFNetworking/AFCompatibilityMacros.h


+ 0 - 0
RunGame/SDK/HTTP/AFNetworking/AFHTTPSessionManager.h → DanceGame/Classes/FitfunTool/FitfunSDK_V2.0/KpSupport/SDK/ThirdClass/AFNetworking/AFHTTPSessionManager.h


+ 0 - 0
RunGame/SDK/HTTP/AFNetworking/AFHTTPSessionManager.m → DanceGame/Classes/FitfunTool/FitfunSDK_V2.0/KpSupport/SDK/ThirdClass/AFNetworking/AFHTTPSessionManager.m


+ 0 - 0
RunGame/SDK/HTTP/AFNetworking/AFNetworkReachabilityManager.h → DanceGame/Classes/FitfunTool/FitfunSDK_V2.0/KpSupport/SDK/ThirdClass/AFNetworking/AFNetworkReachabilityManager.h


+ 0 - 0
RunGame/SDK/HTTP/AFNetworking/AFNetworkReachabilityManager.m → DanceGame/Classes/FitfunTool/FitfunSDK_V2.0/KpSupport/SDK/ThirdClass/AFNetworking/AFNetworkReachabilityManager.m


+ 0 - 0
RunGame/SDK/HTTP/AFNetworking/AFNetworking.h → DanceGame/Classes/FitfunTool/FitfunSDK_V2.0/KpSupport/SDK/ThirdClass/AFNetworking/AFNetworking.h


+ 0 - 0
RunGame/SDK/HTTP/AFNetworking/AFSecurityPolicy.h → DanceGame/Classes/FitfunTool/FitfunSDK_V2.0/KpSupport/SDK/ThirdClass/AFNetworking/AFSecurityPolicy.h


+ 0 - 0
RunGame/SDK/HTTP/AFNetworking/AFSecurityPolicy.m → DanceGame/Classes/FitfunTool/FitfunSDK_V2.0/KpSupport/SDK/ThirdClass/AFNetworking/AFSecurityPolicy.m


+ 0 - 0
RunGame/SDK/HTTP/AFNetworking/AFURLRequestSerialization.h → DanceGame/Classes/FitfunTool/FitfunSDK_V2.0/KpSupport/SDK/ThirdClass/AFNetworking/AFURLRequestSerialization.h


+ 0 - 0
RunGame/SDK/HTTP/AFNetworking/AFURLRequestSerialization.m → DanceGame/Classes/FitfunTool/FitfunSDK_V2.0/KpSupport/SDK/ThirdClass/AFNetworking/AFURLRequestSerialization.m


+ 0 - 0
RunGame/SDK/HTTP/AFNetworking/AFURLResponseSerialization.h → DanceGame/Classes/FitfunTool/FitfunSDK_V2.0/KpSupport/SDK/ThirdClass/AFNetworking/AFURLResponseSerialization.h


+ 0 - 0
RunGame/SDK/HTTP/AFNetworking/AFURLResponseSerialization.m → DanceGame/Classes/FitfunTool/FitfunSDK_V2.0/KpSupport/SDK/ThirdClass/AFNetworking/AFURLResponseSerialization.m


+ 0 - 0
RunGame/SDK/HTTP/AFNetworking/AFURLSessionManager.h → DanceGame/Classes/FitfunTool/FitfunSDK_V2.0/KpSupport/SDK/ThirdClass/AFNetworking/AFURLSessionManager.h


+ 0 - 0
RunGame/SDK/HTTP/AFNetworking/AFURLSessionManager.m → DanceGame/Classes/FitfunTool/FitfunSDK_V2.0/KpSupport/SDK/ThirdClass/AFNetworking/AFURLSessionManager.m


二進制
DanceGame/Classes/FitfunTool/FitfunSDK_V2.0/KpSupport/SDK/ThirdClass/AvoidCrash-master/.DS_Store


二進制
DanceGame/Classes/FitfunTool/FitfunSDK_V2.0/KpSupport/SDK/ThirdClass/Bugly-2.5.9/.DS_Store


+ 0 - 0
RunGame/SDK/HTTP/socket/SRWebSocket.h → DanceGame/Classes/FitfunTool/FitfunSDK_V2.0/KpSupport/SDK/ThirdClass/socket/SRWebSocket.h


+ 0 - 0
RunGame/SDK/HTTP/socket/SRWebSocket.m → DanceGame/Classes/FitfunTool/FitfunSDK_V2.0/KpSupport/SDK/ThirdClass/socket/SRWebSocket.m


+ 0 - 0
RunGame/SDK/HTTP/socket/SocketRocketUtility.h → DanceGame/Classes/FitfunTool/FitfunSDK_V2.0/KpSupport/SDK/ThirdClass/socket/SocketRocketUtility.h


+ 0 - 0
DanceGame/Classes/FitfunTool/FitfunSDK_V2.0/KpSupport/SDK/HTTP/socket/SocketRocketUtility.m → DanceGame/Classes/FitfunTool/FitfunSDK_V2.0/KpSupport/SDK/ThirdClass/socket/SocketRocketUtility.m


+ 5 - 3
DanceGame/Classes/FitfunTool/FitfunSDK_V2.0/KpSupport/SDK/Tool/AlgorithmTool.m

@@ -12,7 +12,7 @@
  //优先计算校验位--无误再进行数据处理  数据前面所有字节数相加是否等于最后一位
 +(BOOL)verificationRusult:(NSData*)characteristicValue{
 
-       if (characteristicValue.length<3){
+       if (characteristicValue.length<4){
             NSLog(@"无效报文");
             return NO;
        }
@@ -87,19 +87,23 @@
 
 //Data To Int:返回 不定个数 Byte的int数据
 +(int)dataToInt:(NSData*)data{
+    
    //2或4个字节
   int a = 0;
   [data getBytes:&a length:data.length];
   return a;
+    
 }
 
 //Data To Int:返回 不定个数 Byte的int数据 数据溢出要大小端转换
 +(int)dataToSwapBigIntToHost:(NSData*)data andRange:(NSRange)range{
+    
    //四个字节
   int a = 0;
   [data getBytes:&a range:range];
   a = NSSwapBigIntToHost(a);
   return a;
+    
 }
 
 /**
@@ -108,7 +112,6 @@
 +(NSString *)hexadecimalString:(NSData *)data{
 
     NSString *result;
-
     const unsigned char *dataBuffer = (const unsigned char *)[data bytes];
     if (!dataBuffer) {
         return nil;
@@ -120,7 +123,6 @@
         [hexString appendString:[NSString stringWithFormat:@"%02lx",(unsigned long)dataBuffer[i]]];
     }
     result = [NSString stringWithString:hexString];
-
     return result;
 
 }

+ 4 - 2
DanceGame/Classes/FitfunTool/FitfunSDK_V2.0/KpSupport/SDK/Tool/BugTool.m

@@ -12,6 +12,7 @@
 @implementation BugTool
 
 +(void)startAvoidBug{
+    
     //bugly抓取
     NSString * bundleIdentifier = [[NSBundle mainBundle] objectForInfoDictionaryKey:@"CFBundleIdentifier"];
     if ([bundleIdentifier isEqualToString:@"com.Oujia.Run"]){
@@ -22,16 +23,17 @@
     //防奔溃
     [AvoidCrash makeAllEffective];
     [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(dealwithCrashMessage:) name:AvoidCrashNotification object:nil];
+    
 }
 
 - (void)dealwithCrashMessage:(NSNotification *)note{
 
- NSDictionary *info = note.userInfo;
+  NSDictionary *info = note.userInfo;
   NSString *errorReason = [NSString stringWithFormat:@"【ErrorReason】%@========【ErrorPlace】%@========【DefaultToDo】%@========【ErrorName】%@", info[@"errorReason"], info[@"errorPlace"], info[@"defaultToDo"], info[@"errorName"]];
   NSLog(@"errorReason = %@",errorReason);
   NSArray *callStack = info[@"callStackSymbols"];
   [self reportErrorName:@"Bugly_ErrorName_AvoidCrash" errorReason:errorReason callStack:callStack extraInfo:nil];
-
+  
 }
 
 /** 上报错误信息 */

+ 0 - 19
DanceGame/Classes/FitfunTool/FitfunSDK_V2.0/KpSupport/SDK/Tool/DebugTool.h

@@ -1,19 +0,0 @@
-//
-//  DebugTool.h
-//  Unity-iPhone
-//
-//  Created by duowan123 on 2022/5/7.
-//
-
-#import <Foundation/Foundation.h>
-#import "SocketRocketUtility.h"
-#import "DebugView.h"
-#import "ShoesInfo.h"
-
-@interface DebugTool : NSObject
-
-+(void)debugMessage:(NSString*)message shoesInfo:(ShoesInfo*)shoesInfo;
-
-
-@end
-

+ 0 - 71
DanceGame/Classes/FitfunTool/FitfunSDK_V2.0/KpSupport/SDK/Tool/DebugTool.m

@@ -1,71 +0,0 @@
-//
-//  DebugTool.m
-//  Unity-iPhone
-//
-//  Created by duowan123 on 2022/5/7.
-//
-
-#import "DebugTool.h"
-
-@implementation DebugTool
-+(void)debugMessage:(NSString*)message shoesInfo:(ShoesInfo*)shoesInfo{
-
-    if (message.length <1){
-        return;
-    }
-   
-    //上传即使动作数据
-    [[SocketRocketUtility sharedInstance] sendData:nil withRequestURI:message];
-    if (DebugViewInstance.RSSI==nil){
-        DebugViewInstance.RSSI = 0;
-    }
-     message = [NSString stringWithFormat:@"%@,%@",message,DebugViewInstance.RSSI];
-    DebugViewInstance.tempStepString = [NSString stringWithFormat:@"%@\n",message];
-    if (DebugViewInstance.tempStepString!=nil && DebugViewInstance.tempStepString.length>1){
-        [DebugViewInstance writeFileToplist];
-    }
-    
-    /********************调试窗数据 *****************/
-    NSArray *aArray = [message componentsSeparatedByString:@","];
-    if (aArray == nil || [aArray isKindOfClass:[NSNull class]] || aArray.count<30){
-        return;
-    }
-//    NSLog(@"aArray == %@",aArray);
-//    dispatch_async(dispatch_get_main_queue(), ^{
-        if (DebugViewInstance.testLabel!=nil){
-            DebugViewInstance.testLabel.text = [NSString stringWithFormat:@"right:[%@,%@,%@] [%@,%@,%@] [%@,%@,%@] [%@,%@,%@] \nleft:[%@,%@,%@] [%@,%@,%@] [%@,%@,%@] [%@,%@,%@]  \nrssi:[%@ %@] ts:%@ \n步数:[%@ %@][%d %d] \n步频:[%d:%d  %d:%d] ",aArray[0],aArray[1],aArray[2],aArray[3],aArray[4],aArray[5],aArray[6],aArray[7],aArray[8],aArray[9],aArray[10],aArray[11],aArray[12],aArray[13],aArray[14],aArray[15],aArray[16],aArray[17],aArray[18],aArray[19],aArray[20],aArray[21],aArray[22],aArray[23],DebugViewInstance.RSSI,aArray[26],aArray[27],aArray[28],aArray[29],shoesInfo.rightStepCount,shoesInfo.leftStepCount,shoesInfo.rightStepStatus,shoesInfo.rightStepFreq,shoesInfo.leftStepStatus,shoesInfo.leftStepFreq];
-        }
-//    });
-    
-    /********************颖嘉+的ts丢包数据 *****************/
-    NSString * tsString =  aArray[27];
-//    NSLog(@"剑波 getGameDataStr 时间戳 ==============>> %@\n",tsString);
-    int tsInt = [tsString  intValue];
-    int total;
-    if (DebugViewInstance.currentTS != 1000){//颖嘉初始值未知 ios初始值==1000
-        //1....255
-        if (tsInt > DebugViewInstance.currentTS){
-             total = tsInt - DebugViewInstance.currentTS - 1;
-        }
-        //255...1
-        if (tsInt < DebugViewInstance.currentTS){
-            if (tsInt ==0){
-                total = (255-DebugViewInstance.currentTS) + tsInt + 1 - 1;
-            }else{
-                total = (255-DebugViewInstance.currentTS) + tsInt - 1;
-            }
-        }
-        if (total > 10){
-            NSLog(@"getGameDataStr 丢包 ================================>> %d",total);
-            dispatch_async(dispatch_get_main_queue(), ^{
-                AudioServicesPlaySystemSound(kSystemSoundID_Vibrate);
-                [PopupView showCusHUDA:[NSString stringWithFormat:@"丢包数: %d",total]];
-            });
-        }
-    }
-//    NSLog(@"tsInt = %d  currentTS = %d total = %d",tsInt,self.currentTS,total);
-    DebugViewInstance.currentTS = tsInt;
-    
-}
-
-@end

二進制
DanceGame/Classes/FitfunTool/FitfunSDK_V2.0/KpSupport/SDK/UI/.DS_Store


+ 6 - 6
DanceGame/Classes/FitfunTool/FitfunSDK_V2.0/KpSupport/SDK/UI/DebugView.h

@@ -7,25 +7,22 @@
 
 #import <UIKit/UIKit.h>
 #import "MYFactoryManager.h"
+#import "SocketRocketUtility.h"
+#import "ShoesInfo.h"
 
 #define DebugViewInstance [DebugView sharedInstance]
 #define JBSDKLog @"testLog.txt"
 
 @interface DebugView : UIView
-/*****测试*******/
-@property (nonatomic,strong)UILabel * testLabel;//调试框
-@property (nonatomic,strong)UIButton * uploadButton;//上传
-@property (nonatomic,strong)UIButton * clearnButton;//上传
 
 //当前的时间戳+丢包
 @property (nonatomic,strong)NSString * tempStepString;//剑波要的字符串数据 缓存plist
-@property(nonatomic,assign) NSNumber *RSSI;//威严要的测试数据
 @property(nonatomic,assign) int currentTS;//颖嘉要的测试数据
 
 +(instancetype)sharedInstance;
 
 #pragma mark ===============================================>> DEBUG
--(void)inittestLabel;
+-(void)initTestLabel;
 
 ////清理缓存
 //- (void)clearCacheWithFilePath;
@@ -36,5 +33,8 @@
 //上传
 -(void)uploadpPlistFile;
     
+//计算实时数据
+-(void)debugMessage:(NSString*)message shoesInfo:(ShoesInfo*)shoesInfo;
+
 @end
 

+ 79 - 3
DanceGame/Classes/FitfunTool/FitfunSDK_V2.0/KpSupport/SDK/UI/DebugView.m

@@ -7,6 +7,14 @@
 
 #import "DebugView.h"
 
+@interface DebugView ()
+/*****测试*******/
+@property (nonatomic,strong)UILabel * testLabel;//调试框
+@property (nonatomic,strong)UIButton * uploadButton;//上传
+@property (nonatomic,strong)UIButton * clearnButton;//上传
+
+@end
+
 @implementation DebugView
 #pragma mark ===============================================>> 静态的初始化方法  init的时候(建立蓝牙中心管理类,设置代理)
 //单例静态
@@ -35,7 +43,7 @@ static DebugView* instance = nil;
 }
 
 #pragma mark ===============================================>> DEBUG
--(void)inittestLabel{
+-(void)initTestLabel{
 
     if (self.testLabel!=nil){
         [self.testLabel removeFromSuperview];
@@ -86,7 +94,7 @@ static DebugView* instance = nil;
 
 }
 
-//  button普通状态下的背景色
+//button普通状态下的背景色
 - (void )button1BackGroundNormal:(UIButton *)sender
 {
      sender.backgroundColor = [UIColor redColor];
@@ -110,8 +118,9 @@ static DebugView* instance = nil;
     //删除子文件夹
     [[NSFileManager defaultManager] removeItemAtPath:filePath error:&error];
     if (error){
-        NSLog(@"清理缓存失败");
+//        NSLog(@"清理缓存失败");
         [PopupView showCusHUDA:@"清理失败"];
+//        [self clearCacheWithFilePath];
     }else{
         NSLog(@"清理缓存成功");
         [PopupView showCusHUDA:@"清理成功"];
@@ -165,6 +174,10 @@ static DebugView* instance = nil;
 //    NSLog(@"%@",string);
     //4.设置请求体
     NSData *upData = [string dataUsingEncoding:NSUTF8StringEncoding];
+//    NSLog(@"uploadpPlistFile upData = %@",upData);
+    if (upData==nil){
+        return;
+    }
     //
     AFHTTPSessionManager *manager = [AFHTTPSessionManager manager];
     manager.requestSerializer.timeoutInterval=15;
@@ -241,5 +254,68 @@ static DebugView* instance = nil;
     return timeSp;
 
 }
+
+
+-(void)debugMessage:(NSString*)message shoesInfo:(ShoesInfo*)shoesInfo{
+
+    if (message.length <1){
+        return;
+    }
+       
+    /********************调试窗数据 *****************/
+    NSArray *aArray = [message componentsSeparatedByString:@","];
+    if (aArray == nil || [aArray isKindOfClass:[NSNull class]] || aArray.count<30){
+        return;
+    }
+    
+    //上传即使动作数据
+    [[SocketRocketUtility sharedInstance] sendData:nil withRequestURI:message];
+    if (LEManager.RSSI == nil){
+        LEManager.RSSI = @0;
+    }
+    //缓存动作数据plist文件
+     message = [NSString stringWithFormat:@"%@,%@",message,LEManager.RSSI];
+    self.tempStepString = [NSString stringWithFormat:@"%@\n",message];
+    if (self.tempStepString!=nil && self.tempStepString.length>1){
+        [self writeFileToplist];
+    }
+    
+//    NSLog(@"aArray == %@",aArray);
+//    dispatch_async(dispatch_get_main_queue(), ^{
+        if (self.testLabel!=nil){
+            self.testLabel.text = [NSString stringWithFormat:@"right:[%@,%@,%@] [%@,%@,%@] [%@,%@,%@] [%@,%@,%@] \nleft:[%@,%@,%@] [%@,%@,%@] [%@,%@,%@] [%@,%@,%@]  \nrssi:[%@ %@] ts:%@ \n步数:[%@ %@][%d %d] \n步频:[%d:%d  %d:%d] ",aArray[0],aArray[1],aArray[2],aArray[3],aArray[4],aArray[5],aArray[6],aArray[7],aArray[8],aArray[9],aArray[10],aArray[11],aArray[12],aArray[13],aArray[14],aArray[15],aArray[16],aArray[17],aArray[18],aArray[19],aArray[20],aArray[21],aArray[22],aArray[23],LEManager.RSSI,aArray[26],aArray[27],aArray[28],aArray[29],shoesInfo.rightStepCount,shoesInfo.leftStepCount,shoesInfo.rightStepStatus,shoesInfo.rightStepFreq,shoesInfo.leftStepStatus,shoesInfo.leftStepFreq];
+        }
+//    });
+    
+    /********************颖嘉+的ts丢包数据 *****************/
+    NSString * tsString =  aArray[27];
+//    NSLog(@"剑波 getGameDataStr 时间戳 ==============>> %@\n",tsString);
+    int tsInt = [tsString  intValue];
+    int total;
+    if (self.currentTS != -1){//颖嘉初始值未知 ios初始值==1000
+        //1....255
+        if (tsInt > self.currentTS){
+             total = tsInt - self.currentTS - 1;
+        }
+        //255...1
+        if (tsInt < self.currentTS){
+            if (tsInt ==0){
+                total = (255-self.currentTS) + tsInt + 1 - 1;
+            }else{
+                total = (255-self.currentTS) + tsInt - 1;
+            }
+        }
+        if (total > 30){
+            NSLog(@"getGameDataStr 丢包 ================================>> %d",total);
+            dispatch_async(dispatch_get_main_queue(), ^{
+                AudioServicesPlaySystemSound(kSystemSoundID_Vibrate);
+                [PopupView showCusHUDA:[NSString stringWithFormat:@"丢包数: %d",total]];
+            });
+        }
+    }
+//    NSLog(@"tsInt = %d  currentTS = %d total = %d",tsInt,self.currentTS,total);
+    self.currentTS = tsInt;
+    
+}
    
 @end

二進制
DanceGame/Classes/FitfunTool/FitfunSDK_V2.0/KpSupport/SDK/resources /.DS_Store


二進制
DanceGame/Classes/FitfunTool/FitfunSDK_V2.0/KpSupport/SDK/shoe_sdk_c/shoes_sdk_2.0/.DS_Store


+ 23 - 29
DanceGame/Unity-iPhone.xcodeproj/project.pbxproj

@@ -193,7 +193,6 @@
 		9326E1A6281A3DD3006ADC6F /* GameInfo.m in Sources */ = {isa = PBXBuildFile; fileRef = 9326E1A5281A3DD3006ADC6F /* GameInfo.m */; };
 		9354476027F57F520055C921 /* StepVel.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9354475F27F57F520055C921 /* StepVel.cpp */; };
 		9354476327F57FA50055C921 /* Kongfu.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9354476227F57FA50055C921 /* Kongfu.cpp */; };
-		9364CF652826156700E63D51 /* DebugTool.m in Sources */ = {isa = PBXBuildFile; fileRef = 9364CF642826156700E63D51 /* DebugTool.m */; };
 		9364CF6828261B0D00E63D51 /* CacheTool.m in Sources */ = {isa = PBXBuildFile; fileRef = 9364CF6728261B0D00E63D51 /* CacheTool.m */; };
 		937CC93327B4B9AD00B9000A /* DefaultLandscape.png in Resources */ = {isa = PBXBuildFile; fileRef = 937CC93227B4B9AD00B9000A /* DefaultLandscape.png */; };
 		937CC93527B4BA9500B9000A /* 2208x1142.jpg in Resources */ = {isa = PBXBuildFile; fileRef = 937CC93427B4BA9500B9000A /* 2208x1142.jpg */; };
@@ -663,8 +662,6 @@
 		9354476127F57F9D0055C921 /* Kongfu.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Kongfu.h; sourceTree = "<group>"; };
 		9354476227F57FA50055C921 /* Kongfu.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = Kongfu.cpp; sourceTree = "<group>"; };
 		935642749A1C0E55C636858E /* Bulk_Assembly-CSharp_1.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = "Bulk_Assembly-CSharp_1.cpp"; path = "Classes/Native/Bulk_Assembly-CSharp_1.cpp"; sourceTree = SOURCE_ROOT; };
-		9364CF632826156700E63D51 /* DebugTool.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = DebugTool.h; sourceTree = "<group>"; };
-		9364CF642826156700E63D51 /* DebugTool.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = DebugTool.m; sourceTree = "<group>"; };
 		9364CF6628261B0D00E63D51 /* CacheTool.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = CacheTool.h; sourceTree = "<group>"; };
 		9364CF6728261B0D00E63D51 /* CacheTool.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = CacheTool.m; sourceTree = "<group>"; };
 		937CC93227B4B9AD00B9000A /* DefaultLandscape.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = DefaultLandscape.png; sourceTree = "<group>"; };
@@ -1211,29 +1208,29 @@
 		937F5B9527FD2B200071BC44 /* AvoidCrash */ = {
 			isa = PBXGroup;
 			children = (
-				937F5B9627FD2B200071BC44 /* NSArray+AvoidCrash.m */,
 				937F5B9727FD2B200071BC44 /* AvoidCrash.h */,
-				937F5B9827FD2B200071BC44 /* NSString+AvoidCrash.m */,
-				937F5B9927FD2B200071BC44 /* NSDictionary+AvoidCrash.m */,
-				937F5B9A27FD2B200071BC44 /* NSAttributedString+AvoidCrash.h */,
-				937F5B9B27FD2B200071BC44 /* AvoidCrashStubProxy.h */,
-				937F5B9C27FD2B200071BC44 /* NSMutableDictionary+AvoidCrash.m */,
+				937F5BA527FD2B200071BC44 /* AvoidCrash.m */,
 				937F5B9D27FD2B200071BC44 /* AvoidCrashProtocol.h */,
-				937F5B9E27FD2B200071BC44 /* NSMutableString+AvoidCrash.m */,
-				937F5B9F27FD2B200071BC44 /* NSObject+AvoidCrash.m */,
-				937F5BA027FD2B200071BC44 /* NSMutableArray+AvoidCrash.m */,
-				937F5BA127FD2B200071BC44 /* NSMutableAttributedString+AvoidCrash.m */,
+				937F5B9B27FD2B200071BC44 /* AvoidCrashStubProxy.h */,
+				937F5BA827FD2B200071BC44 /* AvoidCrashStubProxy.m */,
+				937F5BA627FD2B200071BC44 /* NSArray+AvoidCrash.h */,
+				937F5B9627FD2B200071BC44 /* NSArray+AvoidCrash.m */,
+				937F5B9A27FD2B200071BC44 /* NSAttributedString+AvoidCrash.h */,
 				937F5BA227FD2B200071BC44 /* NSAttributedString+AvoidCrash.m */,
 				937F5BA327FD2B200071BC44 /* NSDictionary+AvoidCrash.h */,
-				937F5BA427FD2B200071BC44 /* NSString+AvoidCrash.h */,
-				937F5BA527FD2B200071BC44 /* AvoidCrash.m */,
-				937F5BA627FD2B200071BC44 /* NSArray+AvoidCrash.h */,
+				937F5B9927FD2B200071BC44 /* NSDictionary+AvoidCrash.m */,
+				937F5BAC27FD2B200071BC44 /* NSMutableArray+AvoidCrash.h */,
+				937F5BA027FD2B200071BC44 /* NSMutableArray+AvoidCrash.m */,
+				937F5BAB27FD2B200071BC44 /* NSMutableAttributedString+AvoidCrash.h */,
+				937F5BA127FD2B200071BC44 /* NSMutableAttributedString+AvoidCrash.m */,
 				937F5BA727FD2B200071BC44 /* NSMutableDictionary+AvoidCrash.h */,
-				937F5BA827FD2B200071BC44 /* AvoidCrashStubProxy.m */,
-				937F5BA927FD2B200071BC44 /* NSObject+AvoidCrash.h */,
+				937F5B9C27FD2B200071BC44 /* NSMutableDictionary+AvoidCrash.m */,
 				937F5BAA27FD2B200071BC44 /* NSMutableString+AvoidCrash.h */,
-				937F5BAB27FD2B200071BC44 /* NSMutableAttributedString+AvoidCrash.h */,
-				937F5BAC27FD2B200071BC44 /* NSMutableArray+AvoidCrash.h */,
+				937F5B9E27FD2B200071BC44 /* NSMutableString+AvoidCrash.m */,
+				937F5BA927FD2B200071BC44 /* NSObject+AvoidCrash.h */,
+				937F5B9F27FD2B200071BC44 /* NSObject+AvoidCrash.m */,
+				937F5BA427FD2B200071BC44 /* NSString+AvoidCrash.h */,
+				937F5B9827FD2B200071BC44 /* NSString+AvoidCrash.m */,
 			);
 			path = AvoidCrash;
 			sourceTree = "<group>";
@@ -1412,6 +1409,8 @@
 		93B6EC6B27DB2B170033A027 /* ThirdClass */ = {
 			isa = PBXGroup;
 			children = (
+				93B6EC7D27DB2B170033A027 /* AFNetworking */,
+				93B6EC8C27DB2B180033A027 /* socket */,
 				937F5B9527FD2B200071BC44 /* AvoidCrash */,
 				93B6EC7427DB2B170033A027 /* MBProgressHUD */,
 				93B6EC7727DB2B170033A027 /* Bugly-2.5.9 */,
@@ -1441,8 +1440,6 @@
 			children = (
 				93B6EC7B27DB2B170033A027 /* HTTPDataProcession.m */,
 				93B6EC7C27DB2B170033A027 /* HTTPDataProcession.h */,
-				93B6EC7D27DB2B170033A027 /* AFNetworking */,
-				93B6EC8C27DB2B180033A027 /* socket */,
 			);
 			path = HTTP;
 			sourceTree = "<group>";
@@ -1548,8 +1545,6 @@
 				93B6ECC527DB2B180033A027 /* AlgorithmTool.m */,
 				937F5BB827FD2D4F0071BC44 /* BugTool.h */,
 				937F5BB927FD2D4F0071BC44 /* BugTool.m */,
-				9364CF632826156700E63D51 /* DebugTool.h */,
-				9364CF642826156700E63D51 /* DebugTool.m */,
 				9364CF6628261B0D00E63D51 /* CacheTool.h */,
 				9364CF6728261B0D00E63D51 /* CacheTool.m */,
 				93B6ECC827DB2B180033A027 /* MYFactoryManager.h */,
@@ -2077,7 +2072,6 @@
 				172B45A2B0C52DBE8F0BB1F5 /* Bulk_Assembly-CSharp_26.cpp in Sources */,
 				93B6ED2D27DB2B180033A027 /* UIView+ST.m in Sources */,
 				F15F48EF858EB1475CABEF98 /* Bulk_Assembly-CSharp_27.cpp in Sources */,
-				9364CF652826156700E63D51 /* DebugTool.m in Sources */,
 				2E364CEA8B2AC9B3591A2611 /* Bulk_Assembly-CSharp_28.cpp in Sources */,
 				9354476027F57F520055C921 /* StepVel.cpp in Sources */,
 				AD4D455099260BDF99C8CC64 /* Bulk_Assembly-CSharp_29.cpp in Sources */,
@@ -2341,7 +2335,7 @@
 				CODE_SIGN_IDENTITY = "Apple Development";
 				CODE_SIGN_STYLE = Automatic;
 				COPY_PHASE_STRIP = NO;
-				CURRENT_PROJECT_VERSION = 10104;
+				CURRENT_PROJECT_VERSION = 11000;
 				DEVELOPMENT_TEAM = 79QQ6HAK8M;
 				ENABLE_BITCODE = NO;
 				FRAMEWORK_SEARCH_PATHS = (
@@ -2421,7 +2415,7 @@
 				CODE_SIGN_IDENTITY = "Apple Development";
 				CODE_SIGN_STYLE = Automatic;
 				COPY_PHASE_STRIP = YES;
-				CURRENT_PROJECT_VERSION = 10104;
+				CURRENT_PROJECT_VERSION = 11000;
 				DEVELOPMENT_TEAM = 79QQ6HAK8M;
 				ENABLE_BITCODE = NO;
 				FRAMEWORK_SEARCH_PATHS = (
@@ -2624,7 +2618,7 @@
 				CODE_SIGN_IDENTITY = "Apple Development";
 				CODE_SIGN_STYLE = Automatic;
 				COPY_PHASE_STRIP = YES;
-				CURRENT_PROJECT_VERSION = 10104;
+				CURRENT_PROJECT_VERSION = 11000;
 				DEBUG_INFORMATION_FORMAT = dwarf;
 				DEVELOPMENT_TEAM = 79QQ6HAK8M;
 				ENABLE_BITCODE = NO;
@@ -2772,7 +2766,7 @@
 				CODE_SIGN_IDENTITY = "Apple Development";
 				CODE_SIGN_STYLE = Automatic;
 				COPY_PHASE_STRIP = YES;
-				CURRENT_PROJECT_VERSION = 10104;
+				CURRENT_PROJECT_VERSION = 11000;
 				DEVELOPMENT_TEAM = 79QQ6HAK8M;
 				ENABLE_BITCODE = NO;
 				FRAMEWORK_SEARCH_PATHS = (

二進制
DanceGame/Unity-iPhone.xcodeproj/project.xcworkspace/xcuserdata/duowan123.xcuserdatad/UserInterfaceState.xcuserstate


二進制
RunGame/.DS_Store


二進制
RunGame/SDK/.DS_Store


+ 4 - 2
RunGame/SDK/BLE/BTDataAnalysis.mm

@@ -100,11 +100,13 @@
 //
 //        }else if (dataType == -95 && characteristic.length == 26){//获取的是查询的数据 char-->int a1 = -95
            //A1+1 >> 1: 设备数据(左鞋,右鞋)  aa 14 eb a1 01 64 00 1a 0000981d 64 00 17 00000000 f9
+    //        NSLog(@"主设备 读取特征的报文 硬件信息 %ld dataType = -95 %@ %ld",(long)deviceType,characteristic,characteristic.length);
+
                 int leftElectricity = [AlgorithmTool dataToInt:[characteristic subdataWithRange:NSMakeRange(5, 1)]];
                 int rightElectricity = [AlgorithmTool dataToInt:[characteristic subdataWithRange:NSMakeRange(15, 1)]];//龙哥新协议
                 
                 if (deviceType==DEVICETYPE_MAIN && LEManager.peripheral!=nil){//主设备
-                    NSLog(@"主设备 接收到 鞋子硬件数据 data 26 = %@  电量 %d %d %@ %@",characteristic,leftElectricity,rightElectricity,LEManager.peripheral.name,LEManager.peripheral.identifier.UUIDString);
+//                    NSLog(@"主设备 接收到 鞋子硬件数据: %@  电量 %d %d %@ %@",characteristic,leftElectricity,rightElectricity,LEManager.peripheral.name,LEManager.peripheral.identifier.UUIDString);
                     //主 设备定时器 60秒调一次   /******************ios call unity*****************/
                      [[IOSPlatformSDK sharedInstance] bridgingDeviceAction:DEVICETYPE_MAIN
                                                  name:LEManager.peripheral.name
@@ -113,7 +115,7 @@
                                           electricity:leftElectricity<=rightElectricity?leftElectricity:rightElectricity];
              
                 }else if (deviceType==DEVICETYPE_VICE && LEManager.vicePeripheral!=nil){//副设备
-                    NSLog(@"副设备 接收到 鞋子硬件数据 26 = %@  电量 %d %d",characteristic,leftElectricity,rightElectricity);
+//                    NSLog(@"副设备 接收到 鞋子硬件数据: %@  电量 %d %d",characteristic,leftElectricity,rightElectricity);
                     //副 设备定时器 60秒调一次   /******************ios call unity*****************/
                      [[IOSPlatformSDK sharedInstance] bridgingDeviceAction:DEVICETYPE_VICE
                                                  name:LEManager.vicePeripheral.name

+ 2 - 16
RunGame/SDK/BLE/BTDataProcess.h

@@ -6,18 +6,7 @@
 //
 
 #import <UIKit/UIKit.h>
-#import "MYFactoryManager.h"
 
-#import "LEONBLManager.h"
-#import "SocketRocketUtility.h"
-
-//游戏类型
-typedef NS_ENUM(int, GAME_TYPE){
-    GAME_TYPE_DEMO =0, //
-    GAME_TYPE_RUN, //
-    GAME_TYPE_DANCE, //
-    GAME_TYPE_SDAER, //
-};
 
 //蓝牙状态
 typedef NS_ENUM(NSInteger, BLETOOTH_STUTAS){
@@ -27,10 +16,10 @@ typedef NS_ENUM(NSInteger, BLETOOTH_STUTAS){
     CONNECT_LOST, // 丢失链接 /链接失败
 };
 
-@interface BTDataProcess : UIViewController
+@interface BTDataProcess : NSObject
 
 @property(assign,nonatomic)int nativeAttX;
-    
+
 //单例->初始化蓝牙
 +(instancetype)sharedInstance;
 
@@ -47,6 +36,3 @@ typedef NS_ENUM(NSInteger, BLETOOTH_STUTAS){
 -(void)vibrationAction:(int)type duration:(int)duration;
 
 @end
-
-
-

+ 268 - 356
RunGame/SDK/BLE/BTDataProcess.mm

@@ -6,7 +6,14 @@
 #import "BTDataProcess.h"
 #import "IOSPlatformSDK.h"
 #include "Game.h"
-#import "MotionCountObj.h"
+
+#import "MYFactoryManager.h"
+
+#import "LEONBLManager.h"
+
+#import "ShoesInfo.h"
+#import "GameInfo.h"
+#import "CacheTool.h"
 
 //#define NSLog(format, ...) printf("TIME:%s FILE:%s(%d行) FUNCTION:%s %s\n",__TIME__, [[[NSString stringWithUTF8String:__FILE__] lastPathComponent] UTF8String], __LINE__, __PRETTY_FUNCTION__, [[NSString stringWithFormat:(format), ##__VA_ARGS__] UTF8String])
 @interface BTDataProcess ()
@@ -16,43 +23,24 @@ Game *game;
 Game *viceDeviceGame;
 }
 
-//趣动跳转过来携带的mac 实际是蓝牙设备的identity
-@property(copy,nonatomic)NSString * macAddress;
-//弹窗 unity主动选择链接 主0 副1 设备
-@property(assign,nonatomic)DEVICE_TYPE deviceType;
-//游戏种类
-@property(assign,nonatomic)GAME_TYPE game_type;
-
-//ios_sdk
-@property (nonatomic,strong)IOSPlatformSDK * sdk;
-
 //蓝牙弹窗
 @property (strong, nonatomic)SearchDeviceViewController * searchDeviceVC;
 //蓝牙外设数据源
 @property (strong, nonatomic)NSMutableArray  * deviceArray;
 
-//定时请求设备状态
+//定时查询设备状态
 @property(nonatomic,weak)NSTimer * timer;
-//程序在前台还是后台
-@property(assign,nonatomic)int isBackGround;
-//鞋子是否开启游戏模式
-@property(nonatomic,assign)BOOL gameModel;
-//当局游戏时间
-@property(nonatomic,strong)NSDate * firstTime;
-//当局游戏跳起、下蹲次数
-@property(assign,nonatomic)int initial_jump_count;
-@property(assign,nonatomic)int initial_down_count;
-@property(nonatomic,strong)MotionCountObj * motionCountObj;
-
-//统计参数
-@property(assign,nonatomic)int tempCount;
+
+//鞋子信息
+@property(nonatomic,strong)ShoesInfo * shoes_info;
+//当局游戏信息
+@property(nonatomic,strong)GameInfo * game_info;
 
 @end
 
 @implementation BTDataProcess
 
-#pragma mark ===============================================>> 静态的初始化方法  init的时候(建立蓝牙中心管理类,设置代理)
-//单例静态
+#pragma mark ===============================================>> 单例
 static BTDataProcess* instance = nil;
 +(instancetype)sharedInstance{
      return [[self alloc] init];
@@ -74,131 +62,17 @@ static BTDataProcess* instance = nil;
     return instance;
 }
 
-#pragma mark ===============================================>> public method
--(void)startWithUrl:(NSURL*)url{//
-    
-    if (url==nil){
-        return;
-    }
-    NSString * urlString = [url absoluteString];
-    NSArray * stringArr = [urlString componentsSeparatedByString:@"//"];
-    if (stringArr == nil || stringArr.count<2){
-        return;
-    }
-    NSString * arr2 = stringArr[1];
-    NSString* finsalString = [arr2 stringByReplacingPercentEscapesUsingEncoding:NSUTF8StringEncoding];
-    NSDictionary * urlDict = [AlgorithmTool dictionaryWithJsonString:finsalString];
-    NSLog(@"Schemes_Url转码的dict ========= %@",urlDict);
-    //缓存用户信息数据
-    [IOS_NSUSERDEFAULT setObject:urlDict forKey:IOSSDK_USERINFO];
-    [IOS_NSUSERDEFAULT synchronize];
-  
-    if ([urlDict isKindOfClass:[NSNull class]] || urlDict == nil || [urlDict isEqual:[NSNull null]]){
-        [PopupView showCusHUDA:@"获取用户信息失败,请从趣动启动"];
-        return;
-    }
-    //主副设备:deviceType  游戏种类:game_type  mac地址:macAddress
-    self.deviceType = DEVICETYPE_MAIN;
-    NSString * game_type = [MYFactoryManager getGameType];
-    self.game_type = (GAME_TYPE)[game_type intValue];
-    self.macAddress = [MYFactoryManager getGameMac];
-    //链接蓝牙
-    [self initCBCentralManager];
-    
-}
-
-//unity call instance弹出蓝牙搜索框
--(void)searchBLEAction:(int)type{
-    
-    /***************************初始化蓝牙数据处理工具***************************/
-    //主副设备:deviceType  游戏种类:game_type  mac地址:macAddress
-    self.deviceType = (DEVICE_TYPE)type;
-    NSString * game_type = [MYFactoryManager getGameType];
-    self.game_type = (GAME_TYPE)[game_type intValue];
-    self.macAddress = @"";
-    //初始化蓝牙CBCentralManager
-    [self initCBCentralManager];
-
-    /***************************搜索蓝牙外设弹窗***************************/
-    self.searchDeviceVC = [SearchDeviceViewController  new];
-    UIViewController *rootVC = [[UIApplication sharedApplication].delegate window].rootViewController;
-    UIViewController *parent = rootVC;
-    while ((parent = rootVC.presentedViewController) != nil ){
-    rootVC = parent;
-    }
-    while ([rootVC isKindOfClass:[UINavigationController class]]){
-    rootVC = [(UINavigationController *)rootVC topViewController];
-    }
-    [rootVC addChildViewController:self.searchDeviceVC];
-    [rootVC.view addSubview:self.searchDeviceVC.view];
-    //点击searchVC的tableViewCell链接选中的蓝牙
-    __weak __typeof(self)weakself = self;
-        self.searchDeviceVC.connectDeviceBlock = ^(CBPeripheral * peripheral){
-        weakself.deviceType = (DEVICE_TYPE)type;
-        [weakself connectPeripheral:peripheral];
-        weakself.macAddress = peripheral.identifier.UUIDString;
-    };
-    
-}
-
-//每重新开始一局游戏
--(void)gameStartInitData{
-    
-    //当局游戏时间
-    self.firstTime = [NSDate date];
-
-    self.motionCountObj = [MotionCountObj new];
-    if (game){
-        self.motionCountObj.step = game->getMotionCount(STEP_COUNT);
-        self.motionCountObj.jump = game->getMotionCount(JUMP_COUNT);
-        self.motionCountObj.crouch = game->getMotionCount(DOWN_COUNT);
-        self.motionCountObj.tick = game->getMotionCount(KICK_COUNT);
-        self.motionCountObj.paper = game->getMotionCount(PAPER_COUNT);
-        self.motionCountObj.scissors = game->getMotionCount(SCISSORS_COUNT);
-        self.motionCountObj.rock = game->getMotionCount(ROCK_COUNT);
-        NSLog(@"self.motionCountObj = %d %d %d %d %d %d %d",self.motionCountObj.step,self.motionCountObj.jump,self.motionCountObj.crouch,self.motionCountObj.tick,self.motionCountObj.paper,self.motionCountObj.scissors,self.motionCountObj.rock);
-    }
-    
-    //游戏模式 ==>> 回调剑波sdk数据
-    self.gameModel = YES;
-    //读写到特征后 添加测试弹窗
-    dispatch_async(dispatch_get_main_queue(), ^{
-        [DebugViewInstance inittestLabel];
-    });
-    
-    //jb
-    [DebugViewInstance clearCacheWithFilePath];
-    
-//    game->start
-    
-}
-
-//每结束一局游戏
--(void)gameEndInitData{
-//    self.gameModel = NO;
-    //jb
-    dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.5 * NSEC_PER_SEC)), dispatch_get_main_queue(),^{
-        [DebugViewInstance uploadpPlistFile];
-    });
-}
-
-//监听通知震动
--(void)vibrationAction:(int)type duration:(int)duration{
-    [BTDataSendInstance vibration:(DEVICE_TYPE)type duration:duration];
-}
-
-#pragma mark ============================>> private
+#pragma mark ===============================================>> private
 -(void)initData{
     
-    //后台模式
-    self.isBackGround = NO;
-    //默认游戏模式关
-    self.gameModel = NO;
+    self.shoes_info = [ShoesInfo new];
+    self.shoes_info.gameModel = NO; //默认游戏模式关
+    self.shoes_info.timestamp = [AlgorithmTool returnTimestamp];//跳转游戏时候的时间戳
+    
+    self.game_info = [GameInfo new];
+    self.game_info.isBackGround = NO; //后台模式
+//    NSLog(@"self.game_info = %d %d %d %d %d %d %d",self.game_info.step,self.game_info.jump,self.game_info.crouch,self.game_info.tick,self.game_info.paper,self.game_info.scissors,self.game_info.rock);
     
-    //固定一个时间戳
-    NSString * timestamp =   [AlgorithmTool returnTimestamp];
-    [IOS_NSUSERDEFAULT setObject:timestamp forKey:IOSSDK_TIMESTAMP];
-    [IOS_NSUSERDEFAULT synchronize];
     
     //监听 趣动 app group 消息 ==>> 好友邀请信息
     CFStringRef invite = (__bridge CFStringRef)@"INVITE_NOTIFICATION";
@@ -221,25 +95,17 @@ static BTDataProcess* instance = nil;
     [CUS_NOTIFICATIONCENTER addObserver:self selector:@selector(enterBackground) name:UIApplicationDidEnterBackgroundNotification object:nil];
     //监听程序 返回 前台
     [CUS_NOTIFICATIONCENTER addObserver:self selector:@selector(willEnterForeground) name:UIApplicationWillEnterForegroundNotification object:nil];
-    //监听程序 被kill
-    [CUS_NOTIFICATIONCENTER addObserver:self selector:@selector(applicationWillTerminate) name:UIApplicationWillTerminateNotification object:nil];
-    
-  }
 
-/** 程序被杀死 */
--(void)applicationWillTerminate{
-  //  - 监听到 app 被杀死时候的回调....
-    NSLog(@"监听到 app 被杀死时候的回调");
 }
 
 -(void)enterBackground{
     NSLog(@"leon UIApplicationDidEnterBackgroundNotification");
-    instance.isBackGround = YES;
+    self.game_info.isBackGround = YES;
 }
 
 -(void)willEnterForeground{
     NSLog(@"leon UIApplicationWillEnterForegroundNotification");
-    instance.isBackGround = NO;
+    self.game_info.isBackGround = NO;
     NSLog(@"程序从后台返回 重连蓝牙 peripheral.state = %ld",LEManager.peripheral.state);
     [self initCBCentralManager];
 }
@@ -248,6 +114,12 @@ void disConnectBle (CFNotificationCenterRef center, void *observer, CFStringRef
     [instance disConnedctBle];
 }
 
+//趣动 ==>> 断开蓝牙
+-(void)disConnedctBle{
+    NSLog(@"趣动 call 断开蓝牙");
+    [LEManager cancelPeripheralConnection];
+}
+//趣动 ==>> 通知邀请好友
 void inviteFriends (CFNotificationCenterRef center, void *observer, CFStringRef name, const void *object, CFDictionaryRef userInfo){
         
     //group.com.Oujia.AppAndGame 沙河数据
@@ -277,20 +149,96 @@ void inviteFriends (CFNotificationCenterRef center, void *observer, CFStringRef
     
 }
 
-//趣动 ==>> 断开蓝牙
--(void)disConnedctBle{
-    NSLog(@"趣动 call 断开蓝牙");
-    [LEManager cancelPeripheralConnection];
+#pragma mark ===============================================>> public method
+-(void)startWithUrl:(NSURL*)url{//
+    
+    if (url==nil){
+        return;
+    }
+    NSString * urlString = [url absoluteString];
+    NSArray * stringArr = [urlString componentsSeparatedByString:@"//"];
+    if (stringArr == nil || stringArr.count<2){
+        return;
+    }
+    NSString * arr2 = stringArr[1];
+    NSString* finsalString = [arr2 stringByReplacingPercentEscapesUsingEncoding:NSUTF8StringEncoding];
+    NSDictionary * urlDict = [AlgorithmTool dictionaryWithJsonString:finsalString];
+    NSLog(@"Schemes_Url转码的dict ========= %@",urlDict);
+    //缓存用户信息数据
+    [IOS_NSUSERDEFAULT setObject:urlDict forKey:IOSSDK_USERINFO];
+    [IOS_NSUSERDEFAULT synchronize];
+  
+    //主副设备:deviceType  游戏种类:game_type  mac地址:macAddress
+    self.game_info.deviceType = DEVICETYPE_MAIN;
+    self.game_info.game_type = (GAME_TYPE)[[MYFactoryManager getGameType] intValue];
+    self.shoes_info.macAddress = [MYFactoryManager getGameMac];
+    
+    //链接蓝牙
+    [self initCBCentralManager];
+    
+    //链接动画
+    [[AnimationView shanreAnimationView] addAnimation];
+    
+}
+
+//unity call instance弹出蓝牙搜索框
+-(void)searchBLEAction:(int)type{
+    
+    //初始化蓝牙CBCentralManager
+    [self initCBCentralManager];
+
+    //搜索蓝牙外设弹窗
+    self.searchDeviceVC = [SearchDeviceViewController  new];
+    [[UIApplication sharedApplication].keyWindow addSubview:self.searchDeviceVC.view];
+
+    //点击searchVC的tableViewCell链接选中的蓝牙
+    __weak __typeof(self)weakself = self;
+    self.searchDeviceVC.connectDeviceBlock = ^(CBPeripheral * peripheral){
+        //主副设备:deviceType  游戏种类:game_type  mac地址:macAddress
+        weakself.game_info.game_type = (GAME_TYPE)[[MYFactoryManager getGameType] intValue];
+        weakself.game_info.deviceType = (DEVICE_TYPE)type;
+        weakself.shoes_info.macAddress = peripheral.identifier.UUIDString;
+        [weakself connectPeripheral:peripheral];
+        //链接动画
+        [[AnimationView shanreAnimationView] addAnimation];
+    };
+    
+}
+
+//每重新开始一局游戏
+-(void)gameStartInitData{
+    
+    //当局游戏时间
+    self.game_info.firstTime = [NSDate date];
+
+    //游戏模式 ==>> 回调剑波sdk数据
+    self.shoes_info.gameModel = YES;
+    //读写到特征后 添加测试弹窗
+    dispatch_async(dispatch_get_main_queue(), ^{
+        [DebugViewInstance initTestLabel];
+    });
+    
+}
+
+//每结束一局游戏
+-(void)gameEndInitData{
+//    self.shoes_info.gameModel = NO;
+    //jb
+    dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.5 * NSEC_PER_SEC)), dispatch_get_main_queue(),^{
+        [DebugViewInstance uploadpPlistFile];
+    });
+}
+
+//监听通知震动
+-(void)vibrationAction:(int)type duration:(int)duration{
+    [BTDataSendInstance vibration:(DEVICE_TYPE)type duration:duration];
 }
 
+
 #pragma mark ===============================================>> leon Ble manager
 //测试自己封装的蓝牙类
 -(void)initCBCentralManager{
     
-    //建立socket链接
-    SocketRocketUtility * install = [SocketRocketUtility sharedInstance];
-    [install SRWebSocketOpen];
-
     if (LEManager.centralManager == nil && LEManager.peripheral == nil && LEManager.vicePeripheral == nil){
         [LEManager initCBCentralManager];
         NSLog(@" ====================>> 未初始化 centralManager 直接开始初始化");
@@ -316,7 +264,7 @@ void inviteFriends (CFNotificationCenterRef center, void *observer, CFStringRef
             case 4:{
                 NSLog(@"当前的蓝牙状态 ===>> 蓝牙已关闭");
                 if (LEManager.peripheral!=nil){
-                    [self.sdk bridgingDeviceAction:DEVICETYPE_MAIN
+                    [[IOSPlatformSDK sharedInstance] bridgingDeviceAction:DEVICETYPE_MAIN
                                                 name:LEManager.peripheral.name
                                              address:LEManager.peripheral.identifier.UUIDString
                                               status:CONNECT_LOST
@@ -324,7 +272,7 @@ void inviteFriends (CFNotificationCenterRef center, void *observer, CFStringRef
                 }
                 
                 if (LEManager.vicePeripheral!=nil){
-                    [self.sdk bridgingDeviceAction:DEVICETYPE_VICE
+                    [[IOSPlatformSDK sharedInstance] bridgingDeviceAction:DEVICETYPE_VICE
                                                 name:LEManager.vicePeripheral.name
                                              address:LEManager.vicePeripheral.identifier.UUIDString
                                               status:CONNECT_LOST
@@ -341,6 +289,7 @@ void inviteFriends (CFNotificationCenterRef center, void *observer, CFStringRef
             default:
                 break;
         }
+        //
         
     };
     
@@ -357,11 +306,9 @@ void inviteFriends (CFNotificationCenterRef center, void *observer, CFStringRef
 //                    NSLog(@"主设备扫描发现有效的蓝牙设备 =============== %@   identifier == %@",peripheral.name,peripheral.identifier.UUIDString);
 
                     if (self.deviceArray.count == 0){//数据源为0
-                        
                             [self.deviceArray addObject:peripheral];
                             //判断扫描到外设之后是否要链接蓝牙
                             [self ifAppJumpWithIdentifier:peripheral];
-                        
                     }else{
                         
                             BOOL isExist = NO;
@@ -372,14 +319,13 @@ void inviteFriends (CFNotificationCenterRef center, void *observer, CFStringRef
                                     [self.deviceArray replaceObjectAtIndex:i withObject:peripheral];
                                 }
                             }
-                        
                             if (!isExist){
                                 [self.self.deviceArray addObject:peripheral];
                                 //判断扫描到外设之后是否要链接蓝牙
                                 [self ifAppJumpWithIdentifier:peripheral];
                             }
                     }
-                    
+                                        
                     //数据回调给 搜索蓝牙弹窗
                     self.searchDeviceVC.deviceArray = self.deviceArray;
                     [self.searchDeviceVC reloadData];
@@ -394,7 +340,8 @@ void inviteFriends (CFNotificationCenterRef center, void *observer, CFStringRef
 //是否是app跳转传参 区分app跳转和弹窗搜索 type=0的时候才会执行该方法 type=0的时候才会执行该方法 当时弹框的时候type==1 不执行该方法
 -(void)ifAppJumpWithIdentifier:(CBPeripheral*)peripheral{
     
-    if (self.macAddress!=nil && [peripheral.identifier.UUIDString isEqualToString:self.macAddress]){//app跳转过来 主动链接蓝牙
+//    NSLog(@"self.shoes_info.macAddress = %@  peripheral.identifier.UUIDString = %@",self.shoes_info.macAddress,peripheral.identifier.UUIDString);
+    if (self.shoes_info.macAddress!=nil && [peripheral.identifier.UUIDString isEqualToString:self.shoes_info.macAddress]){//app跳转过来 主动链接蓝牙
         [self connectPeripheral:peripheral];
     }
     
@@ -406,21 +353,26 @@ void inviteFriends (CFNotificationCenterRef center, void *observer, CFStringRef
     
     if(instance!=NULL && peripheral!=NULL){
        
-        self.sdk = [IOSPlatformSDK sharedInstance];//蓝牙数据经过sdk数据转换后 ios call unity
-        DebugViewInstance.currentTS = 1000;
-        NSLog(@"BTDataProcess connectPeripheral self.deviceType ==>> %ld  self.game_type ==>> %d   mac ==>>  %@",(long)self.deviceType,self.game_type,self.macAddress);
+        NSLog(@"BTDataProcess connectPeripheral self.game_info.deviceType ==>> %ld  self.game_info.game_type ==>> %d   mac ==>>  %@",(long)self.game_info.deviceType,self.game_info.game_type,self.shoes_info.macAddress);
+        
+        //建立socket链接
+        SocketRocketUtility * install = [SocketRocketUtility sharedInstance];
+        [install SRWebSocketOpen];
+        
+        //初始化实时时间戳
+        DebugViewInstance.currentTS = -1;
         
         //初始化运轨sdk
-        if (self.deviceType==DEVICETYPE_MAIN){
+        if (self.game_info.deviceType==DEVICETYPE_MAIN){
             LEManager.peripheral = peripheral;
-            game = new Game(self.game_type);
-        }else if (self.deviceType == DEVICETYPE_VICE){
+            game = new Game(self.game_info.game_type);
+        }else if (self.game_info.deviceType == DEVICETYPE_VICE){
             LEManager.vicePeripheral = peripheral;
-            viceDeviceGame = new Game(self.game_type);
+            viceDeviceGame = new Game(self.game_info.game_type);
         }
         
         //根据ios_sdk传入deviceType 链接 主/副 设备
-        [self connectBLEManagerData:peripheral deviceType:self.deviceType];
+        [self connectBLEManagerData:peripheral deviceType:self.game_info.deviceType];
     
     }
     
@@ -429,11 +381,42 @@ void inviteFriends (CFNotificationCenterRef center, void *observer, CFStringRef
 //链接主副设备 + 绑定特征
 -(void)connectBLEManagerData:(CBPeripheral*)peripheral deviceType:(DEVICE_TYPE)deviceType{
     
-    //链接动画
-    [[AnimationView shanreAnimationView] addAnimation];
-    
+        
     //链接蓝牙 此时 LEManager.peripheral || LEManager.vicePeripheral 还未init
     [LEManager connectPeripheral:peripheral options:nil];
+    
+    //蓝牙连接成功
+    LEManager.successfulBlock = ^(CBPeripheral * _Nonnull peripheral){
+        NSLog(@"蓝牙链接成功");
+    };
+
+    //蓝牙连接失败
+    LEManager.connectFailureBlock = ^(NSError * _Nonnull error){
+        NSLog(@"蓝牙链接失败");
+    };
+
+    //蓝牙连接丢失
+    LEManager.disConnectBlock = ^(CBPeripheral * _Nonnull peripheral, NSError * _Nonnull error){
+        NSLog(@"蓝牙链接丢失");
+        if (LEManager.peripheral!=nil&&peripheral == LEManager.peripheral){
+            [[IOSPlatformSDK sharedInstance] bridgingDeviceAction:DEVICETYPE_MAIN
+                                        name:LEManager.peripheral.name
+                                     address:LEManager.peripheral.identifier.UUIDString
+                                      status:CONNECT_LOST
+                                 electricity:0];
+        }
+        
+        if (LEManager.vicePeripheral!=nil&&peripheral == LEManager.vicePeripheral){
+            [[IOSPlatformSDK sharedInstance] bridgingDeviceAction:DEVICETYPE_VICE
+                                        name:LEManager.vicePeripheral.name
+                                     address:LEManager.vicePeripheral.identifier.UUIDString
+                                      status:CONNECT_LOST
+                                 electricity:0];
+        }
+        //断线重连
+        [self initCBCentralManager];
+    };
+    
     //发现服务和特征
     LEManager.discoverCharacteristicsBlock = ^(CBPeripheral * _Nonnull peripheral, CBService * _Nonnull service, NSArray * _Nonnull characteristics, NSError * _Nonnull error){
         
@@ -478,9 +461,10 @@ void inviteFriends (CFNotificationCenterRef center, void *observer, CFStringRef
     
     //读取特征的报文数据
     LEManager.readValueForCharacteristicBlock = ^(CBPeripheral * _Nonnull peripheral, CBCharacteristic * _Nonnull characteristic, NSData * _Nonnull value, NSError * _Nonnull error, DEVICE_TYPE type){
-        if ([characteristic.UUID.UUIDString isEqualToString:@"6E400003-B5A3-F393-E0A9-E50E24DCCA9E"]){//判断是不是我们设备的特征值
-//            NSLog(@"characteristic.UUID.UUIDString = %@",characteristic.UUID.UUIDString);
+        //            NSLog(@"characteristic.UUID.UUIDString = %@",characteristic.UUID.UUIDString);
+//        NSLog(@"characteristic.value = %@",characteristic.value);
 
+        if ([characteristic.UUID.UUIDString isEqualToString:@"6E400003-B5A3-F393-E0A9-E50E24DCCA9E"]){//判断是不是我们设备的特征值
             //每收到数据包读取一次蓝牙RSSI 无论1秒内请求多少次rssi值,原生api每秒都最多返回一次RSSI
             [peripheral readRSSI];
             
@@ -488,27 +472,43 @@ void inviteFriends (CFNotificationCenterRef center, void *observer, CFStringRef
             if ([AlgorithmTool verificationRusult:characteristic.value]==YES){
                 
                 int dataType = [AlgorithmTool dataToChar:[characteristic.value subdataWithRange:NSMakeRange(3, 1)]];//cmd类型
-//                NSLog(@"读取特征的报文 游戏数据 %ld dataType = %d %@",(long)type,dataType,characteristic.value);
-                  if (dataType == 4){//获取主动推过来的数据
+//                char dataType_char = [AlgorithmTool dataToChar:[characteristic.value subdataWithRange:NSMakeRange(3, 1)]];//cmd类型
+                
+                  if (dataType == 4){//鞋子游戏数据
+                      
+                          if (characteristic.value.length < 64){
+                              return;
+                          }
                       
+                          //成功打开游戏模式 隐藏加载框
+                          [[AnimationView shanreAnimationView] stopAnimation];
+
                           //数据丢给算法计算轨迹
                           if (type == DEVICETYPE_MAIN&&LEManager.main_read == 0){
 //                              NSLog(@"LEManager.main_read = %d",LEManager.main_read);
+//                              NSLog(@"主设备 读取特征的报文 游戏数据 %ld dataType = %d %@",(long)type,dataType,characteristic.value);
                               LEManager.main_read = 1;
                               [self shoseSDK:characteristic.value];
                           }else if (type == DEVICETYPE_VICE&&LEManager.vice_read == 0){
-                              NSLog(@"LEManager.vice_read = %d",LEManager.main_read);
+//                              NSLog(@"LEManager.vice_read = %d",LEManager.main_read);
+//                              NSLog(@"副设备 读取特征的报文 游戏数据 %ld dataType = %d %@",(long)type,dataType,characteristic.value);
                               LEManager.vice_read = 1;
                               [self viceShoseSDK:characteristic.value];
                           }
                       
-                  }else if(dataType == -95){//读取基本信息
+                  }else if(dataType == -95){//鞋子状态信息
+                      
+                          if (characteristic.value.length<30){
+                              return;
+                          }
+                      
                           //嵌入式原始数据解析 --->> 回调蓝牙状态/电量给unity
                           BTDataAnalysis * anly = [BTDataAnalysis new];
                           [anly analysisCharacteristic:characteristic.value deviceType:type];
+                      
                   }
                       
-            }
+             }
             
          }
         
@@ -520,50 +520,11 @@ void inviteFriends (CFNotificationCenterRef center, void *observer, CFStringRef
     
     //蓝牙更新RSSI
     LEManager.rssiBlock = ^(NSNumber * _Nonnull RSSI){
-        DebugViewInstance.RSSI = RSSI;
+        LEManager.RSSI = RSSI;
 //        NSLog(@"self.RSSI  = %@",self.RSSI);
     };
     
-    //蓝牙连接成功
-    LEManager.successfulBlock = ^(CBPeripheral * _Nonnull peripheral){
-        NSLog(@"蓝牙链接成功");
-            [[AnimationView shanreAnimationView] stopAnimation];
-    };
 
-    //蓝牙连接失败
-    LEManager.connectFailureBlock = ^(NSError * _Nonnull error){
-        NSLog(@"蓝牙链接失败");
-    };
-
-    //蓝牙连接丢失
-    LEManager.disConnectBlock = ^(CBPeripheral * _Nonnull peripheral, NSError * _Nonnull error){
-        
-        if (LEManager.peripheral!=nil&&peripheral == LEManager.peripheral){
-            
-            [self.sdk bridgingDeviceAction:DEVICETYPE_MAIN
-                                        name:LEManager.peripheral.name
-                                     address:LEManager.peripheral.identifier.UUIDString
-                                      status:CONNECT_LOST
-                                 electricity:0];
-            
-        }
-        
-        if (LEManager.vicePeripheral!=nil&&peripheral == LEManager.vicePeripheral){
-            
-            [self.sdk bridgingDeviceAction:DEVICETYPE_VICE
-                                        name:LEManager.vicePeripheral.name
-                                     address:LEManager.vicePeripheral.identifier.UUIDString
-                                      status:CONNECT_LOST
-                                 electricity:0];
-            
-        }
-        
-        NSLog(@"蓝牙链接丢失");
-        //断线重连
-        [self initCBCentralManager];
-        
-    };
-    
 }
 
 #pragma mark ===============================================>> 读取特征后 鞋子打开游戏模式 & 激光开关 &查询鞋子蓝牙状态 & 主设备初始化缓存游戏步数
@@ -579,7 +540,7 @@ void inviteFriends (CFNotificationCenterRef center, void *observer, CFStringRef
         [self.timer invalidate];
         self.timer = nil;
     }
-    self.timer = [NSTimer scheduledTimerWithTimeInterval:15 target:self selector:@selector(timingDataTransmission:) userInfo:nil repeats:YES];
+    self.timer = [NSTimer scheduledTimerWithTimeInterval:10 target:self selector:@selector(timingDataTransmission:) userInfo:nil repeats:YES];
     [[NSRunLoop currentRunLoop] addTimer:self.timer forMode:NSDefaultRunLoopMode];
 
 }
@@ -587,7 +548,7 @@ void inviteFriends (CFNotificationCenterRef center, void *observer, CFStringRef
 //定时发送数据
 -(void)timingDataTransmission:(NSString*)style{
     
-    if (self.isBackGround){//程序在后台
+    if (self.game_info.isBackGround){//程序在后台
     }else{//程序在前台
         [BTDataSendInstance startGameModel];
     }
@@ -598,76 +559,83 @@ void inviteFriends (CFNotificationCenterRef center, void *observer, CFStringRef
 #pragma mark ===============================================>> 主设备 报文数据解析后 -- 调用蓝牙鞋子SDK装换数据 -- ios call unity 更新游戏动作
 -(void)shoseSDK:(NSData*)characteristic{
         
-        if (self.gameModel==YES){//当前是游戏模式
+//    NSLog(@"characteristic = %@",characteristic);
+
+        if (self.shoes_info.gameModel==YES){//当前是游戏模式
             
             /********************初始化 运动轨迹算法 SDK *****************/
-        //    NSLog(@"characteristic = %@",characteristic);
             NSData * validData= [characteristic subdataWithRange:NSMakeRange(4, characteristic.length-4)];
             Byte * buff = (Byte*)[validData bytes];
             game->GameProcessBuf(buff, (int)validData.length);
             
+            /********************剑波 & 威严 要的图表数据 *****************/
+            NSString * message = [NSString stringWithUTF8String:game->getGameDataStr().c_str()];
+            [DebugViewInstance debugMessage:message shoesInfo:self.shoes_info];
+            
+            /******************左右脚动作数据处理 + 回调*****************/
             int length = 4;
             int result[length];
             game->getGameResult(result);
         //   NSLog(@"result == %d %d %d %d \n",result[0],result[1],result[2],result[3]);
-                
-            /******************左右脚动作数据处理 + 回调*****************/
             int motionLeft = result[0];//左脚的动作
             int motionRight = result[1];//右脚的动作
             int motionJump = result[2];//jump
             int motionDown = result[3];//down
-        //    if (motionLeft==-1 && motionRight == -1&& motionJump == -1&& motionDown == -1){//无效动作
-        //        return;
-        //    }else{
+            
+            //无效动作
+            if (motionLeft==-1 && motionRight == -1&& motionJump == -1&& motionDown == -1){
+                return;
+            }else{
+                
                 //跳跃和蹲下的动作 双脚是同步的
                 if (motionJump == MOTION_JUMP){
                     motionLeft = motionJump;
                     motionRight = motionJump;
-                    NSLog(@" 主设备 ================================== 跳起来 ");
+//                    NSLog(@" 主设备 ================================== 跳起来 ");
                 }
             
                 if (motionDown == MOTION_DOWN){
                     motionLeft = motionDown;
                     motionRight = motionDown;
-                    NSLog(@" 主设备 =================================== 蹲下去 ");
+//                    NSLog(@" 主设备 =================================== 蹲下去 ");
                 }
-        //    }
-            
-            /******************步频数据处理 + 回调*****************/
-            int leftStepStatus =  game->getStepStatus(LEFT_FOOT);
-            int leftStepFreq =  game->getStepFreq(LEFT_FOOT);
-            int leftStepCount =  game->getStepCount(LEFT_FOOT);
-            int rightStepStatus =  game->getStepStatus(RIGHT_FOOT);
-            int rightStepFreq =  game->getStepFreq(RIGHT_FOOT);
-            int rightStepCount =  game->getStepCount(RIGHT_FOOT);
-            
-            /******************玩家当前朝向 用户赛车*****************/
-        //    int attLength = 3;
-        //    int left[attLength];
-        //    int right[attLength];
-        //     game->getFootAtt(left, right);
-        //    self.nativeAttX = left[0];
-        //    NSLog(@"self.nativeAttX = %d",self.nativeAttX);
-            
-            //跑酷需要回调步频
-            if (self.game_type == GAME_TYPE_RUN){
-                [self.sdk bridgingStepAction:DEVICETYPE_MAIN leftStatus:leftStepStatus rightStatus:rightStepStatus leftFrag:leftStepFreq rightFrag:rightStepFreq];
-            }
-            //左右脚动作
-            [self.sdk bridgingMotionAction:DEVICETYPE_MAIN left:motionLeft right:motionRight];
-            
-            //当局运动数据缓存
-            [self cacheAllMotionCount:leftStepCount+rightStepCount];
-            
-            //测试数据
-            [self tempTest:rightStepFreq leftStepFreq:leftStepFreq];
-
+                
+                /******************当局鞋子子动作状态数据 缓存*****************/
+                self.shoes_info.leftStepStatus =  game->getStepStatus(LEFT_FOOT);
+                self.shoes_info.leftStepFreq =  game->getStepFreq(LEFT_FOOT);
+                self.shoes_info.leftStepCount =  game->getStepCount(LEFT_FOOT);
+                self.shoes_info.rightStepStatus =  game->getStepStatus(RIGHT_FOOT);
+                self.shoes_info.rightStepFreq =  game->getStepFreq(RIGHT_FOOT);
+                self.shoes_info.rightStepCount =  game->getStepCount(RIGHT_FOOT);
+                [self cacheAllMotionCount];
+                    
+                /******************鞋子动作状态数据 实时回调*****************/
+                //左右脚动作:所有游戏都需要回调
+                [[IOSPlatformSDK sharedInstance] bridgingMotionAction:DEVICETYPE_MAIN left:motionLeft right:motionRight];
+                
+                //步频状态:只有跑酷回调
+                if (self.game_info.game_type == GAME_TYPE_RUN){
+                    [[IOSPlatformSDK sharedInstance] bridgingStepAction:DEVICETYPE_MAIN leftStatus:self.shoes_info.leftStepStatus rightStatus:self.shoes_info.rightStepStatus leftFrag:self.shoes_info.leftStepFreq rightFrag:self.shoes_info.rightStepFreq];
+                }
+                
+                //人物朝向 只有 三轮车 需要
+                if (self.game_info.game_type == GAME_TYPE_CYCLE){
+                        int attLength = 3;
+                        int left[attLength];
+                        int right[attLength];
+                         game->getFootAtt(left, right);
+                        self.nativeAttX = left[0];
+                        NSLog(@"self.nativeAttX = %d",self.nativeAttX);
+                }
+                
+           }
+     
         }else{//当前是交互模式
 
 //            int interaction = game->getInteractionCMD();
 ////            NSLog(@"主设备 当前的脚步交互动作 ===== >> %d",interaction);
 //            //游戏交互
-//            [self.sdk bridgingInteraction:DEVICETYPE_MAIN code:interaction];
+//            [[IOSPlatformSDK sharedInstance] bridgingInteraction:DEVICETYPE_MAIN code:interaction];
 //            //自定义弹窗界面交互
 //            if (interaction!=-1){
 //                NSLog(@"BTDataProcess 有效交互动作 ===>> %d",interaction);
@@ -679,68 +647,6 @@ void inviteFriends (CFNotificationCenterRef center, void *observer, CFStringRef
     
 }
 
-//算法需要的测试数据
--(void)tempTest:(int)rightStepFreq leftStepFreq:(int)leftStepFreq{
-    
-    /********************剑波 & 威严 要的图表数据 *****************/
-    NSString * aString = [NSString stringWithUTF8String:game->getGameDataStr().c_str()];
-//    NSLog(@"aString == %@",aString);
-    if (aString.length <1){
-        return;
-    }
-   
-    //上传即使动作数据
-    [[SocketRocketUtility sharedInstance] sendData:nil withRequestURI:aString];
-    if (DebugViewInstance.RSSI==nil){
-        DebugViewInstance.RSSI = 0;
-    }
-     aString = [NSString stringWithFormat:@"%@,%@",aString,DebugViewInstance.RSSI];
-    DebugViewInstance.tempStepString = [NSString stringWithFormat:@"%@\n",aString];
-    if (DebugViewInstance.tempStepString!=nil && DebugViewInstance.tempStepString.length>1){
-        [DebugViewInstance writeFileToplist];
-    }
-    
-    /********************调试窗数据 *****************/
-    NSArray *aArray = [aString componentsSeparatedByString:@","];
-    if (aArray == nil || [aArray isKindOfClass:[NSNull class]] || aArray.count<30){
-        return;
-    }
-//    NSLog(@"aArray == %@",aArray);
-    dispatch_async(dispatch_get_main_queue(), ^{
-        if (DebugViewInstance.testLabel!=nil){
-            DebugViewInstance.testLabel.text = [NSString stringWithFormat:@"right:[%@,%@,%@] [%@,%@,%@] [%@,%@,%@] [%@,%@,%@] \nleft:[%@,%@,%@] [%@,%@,%@] [%@,%@,%@] [%@,%@,%@]  \nrssi:[%@ %@] ts:%@ \n脚步:[%@ %@] \n步频:[%d %d] ",aArray[0],aArray[1],aArray[2],aArray[3],aArray[4],aArray[5],aArray[6],aArray[7],aArray[8],aArray[9],aArray[10],aArray[11],aArray[12],aArray[13],aArray[14],aArray[15],aArray[16],aArray[17],aArray[18],aArray[19],aArray[20],aArray[21],aArray[22],aArray[23],DebugViewInstance.RSSI,aArray[26],aArray[27],aArray[28],aArray[29],rightStepFreq,leftStepFreq];
-        }
-    });
-    
-    /********************颖嘉+的ts丢包数据 *****************/
-    NSString * tsString =  aArray[27];
-//    NSLog(@"剑波 getGameDataStr 时间戳 ==============>> %@\n",tsString);
-    int tsInt = [tsString  intValue];
-    int total;
-    if (DebugViewInstance.currentTS != 1000){//颖嘉初始值未知 ios初始值==1000
-        //1....255
-        if (tsInt > DebugViewInstance.currentTS){
-             total = tsInt - DebugViewInstance.currentTS - 1;
-        }
-        //255...1
-        if (tsInt < DebugViewInstance.currentTS){
-            if (tsInt ==0){
-                total = (255-DebugViewInstance.currentTS) + tsInt + 1 - 1;
-            }else{
-                total = (255-DebugViewInstance.currentTS) + tsInt - 1;
-            }
-        }
-        if (total > 20){
-            NSLog(@"getGameDataStr 丢包 ================================>> %d",total);
-            dispatch_async(dispatch_get_main_queue(), ^{
-                AudioServicesPlaySystemSound(kSystemSoundID_Vibrate);
-                [PopupView showCusHUDA:[NSString stringWithFormat:@"丢包数: %d",total]];
-            });
-        }
-    }
-//    NSLog(@"tsInt = %d  currentTS = %d total = %d",tsInt,self.currentTS,total);
-    DebugViewInstance.currentTS = tsInt;
-}
 
 #pragma mark ===============================================>>副设备 报文数据解析后 -- 调用蓝牙鞋子SDK装换数据 -- ios call unity 更新游戏动作
 -(void)viceShoseSDK:(NSData*)characteristic{
@@ -770,9 +676,10 @@ void inviteFriends (CFNotificationCenterRef center, void *observer, CFStringRef
     int ivce_motionJump = result[2];//jump
     int ivce_motionDown = result[3];//down
     
-//    if (motionLeft==-1 && motionRight == -1&& ivce_motionJump == -1&& ivce_motionDown == -1){//无效动作
-//        return;
-//    }else{
+    if (motionLeft==-1 && motionRight == -1&& ivce_motionJump == -1&& ivce_motionDown == -1){//无效动作
+        return;
+    }else{
+        
         //跳跃和蹲下的动作 双脚是同步的
         if (ivce_motionJump == MOTION_JUMP){
             motionLeft = ivce_motionJump;
@@ -786,13 +693,13 @@ void inviteFriends (CFNotificationCenterRef center, void *observer, CFStringRef
         }
         
         //ios call unity
-        if (self.game_type == GAME_TYPE_RUN){//跑酷才需要回调
-            [self.sdk bridgingStepAction:DEVICETYPE_VICE leftStatus:leftStepStatus rightStatus:rightStepStatus leftFrag:leftStepFreq rightFrag:rightStepFreq];//副设备左右脚速度 步频
+        if (self.game_info.game_type == GAME_TYPE_RUN){//跑酷才需要回调
+            [[IOSPlatformSDK sharedInstance] bridgingStepAction:DEVICETYPE_VICE leftStatus:leftStepStatus rightStatus:rightStepStatus leftFrag:leftStepFreq rightFrag:rightStepFreq];//副设备左右脚速度 步频
         }
         //ios call unity
-        [self.sdk bridgingMotionAction:DEVICETYPE_VICE left:motionLeft right:motionRight];//副设备左右脚动作
-    
-    //}
+        [[IOSPlatformSDK sharedInstance] bridgingMotionAction:DEVICETYPE_VICE left:motionLeft right:motionRight];//副设备左右脚动作
+        
+    }
     
 }
 
@@ -804,17 +711,18 @@ void inviteFriends (CFNotificationCenterRef center, void *observer, CFStringRef
     return _deviceArray;;
 }
 
-#pragma mark ===============================================>>玩游戏过程中缓存 动作数据 和时间戳 数据存入plist
--(void)cacheAllMotionCount:(int)totalStep{
+#pragma mark ===============================================>> 玩游戏过程中缓存 动作数据 和时间戳 数据存入plist
+-(void)cacheAllMotionCount{
     
     //总数
-    int total_step_count = game->getMotionCount(STEP_COUNT) - self.motionCountObj.step;
-    int total_jump_count = game->getMotionCount(JUMP_COUNT) - self.motionCountObj.jump;
-    int total_crouch_count = game->getMotionCount(DOWN_COUNT) - self.motionCountObj.crouch;
-    int total_tick_count = game->getMotionCount(KICK_COUNT) - self.motionCountObj.tick;
-    int total_paper_count = game->getMotionCount(PAPER_COUNT) - self.motionCountObj.paper;
-    int total_scissors_count = game->getMotionCount(SCISSORS_COUNT) - self.motionCountObj.scissors;
-    int total_rock_count = game->getMotionCount(ROCK_COUNT) - self.motionCountObj.rock;
+    int total_step_count = game->getMotionCount(STEP_COUNT) - self.game_info.step;
+    int total_jump_count = game->getMotionCount(JUMP_COUNT) - self.game_info.jump;
+    int total_crouch_count = game->getMotionCount(DOWN_COUNT) - self.game_info.crouch;
+    int total_tick_count = game->getMotionCount(KICK_COUNT) - self.game_info.tick;
+    int total_paper_count = game->getMotionCount(PAPER_COUNT) - self.game_info.paper;
+    int total_scissors_count = game->getMotionCount(SCISSORS_COUNT) - self.game_info.scissors;
+    int total_rock_count = game->getMotionCount(ROCK_COUNT) - self.game_info.rock;
+//    int total_trample_count = game->getMotionCount(ROCK_COUNT) - self.game_info.trample;
 
     //缓存pilst文件
     NSMutableDictionary * motionCountObj = [NSMutableDictionary new];
@@ -829,9 +737,12 @@ void inviteFriends (CFNotificationCenterRef center, void *observer, CFStringRef
 
     NSMutableDictionary * movements = [NSMutableDictionary new];
     [movements setObject:motionCountObj forKey:@"movements"];
-    NSTimeInterval durationTime = [[NSDate date] timeIntervalSinceDate:self.firstTime];//游戏总共经历的时长 秒数
+    //游戏总共经历的时长(秒数)
+    NSTimeInterval durationTime = [[NSDate date] timeIntervalSinceDate:self.game_info.firstTime];
     [movements setObject:[NSNumber numberWithInt:durationTime] forKey:@"duration"];
-
+    //时间戳
+    [movements setObject: self.shoes_info.timestamp forKey:@"play_group"];
+    
     NSDictionary * dict = [NSDictionary dictionaryWithDictionary:movements];
         
     //归档缓存
@@ -841,3 +752,4 @@ void inviteFriends (CFNotificationCenterRef center, void *observer, CFStringRef
 }
 
 @end
+

+ 2 - 2
RunGame/SDK/BLE/LEONBLManager.h

@@ -9,7 +9,7 @@
 #import <CoreBluetooth/CoreBluetooth.h>
 
 //设备类型
-typedef NS_ENUM(NSInteger, DEVICE_TYPE){
+typedef NS_ENUM(int, DEVICE_TYPE){
     DEVICETYPE_MAIN =0, //主设备
     DEVICETYPE_VICE, //副设备
 };
@@ -83,10 +83,10 @@ typedef void(^RSSIBlock)(NSNumber *RSSI);
 @property(assign,nonatomic)int vice_read;
 
 /**测试参数start*/
-//临时的时间戳
 @property(assign,nonatomic)int totalPackages;
 @property(assign,nonatomic)int totalLoss;
 @property(assign,nonatomic)int tempTs;
+@property(nonatomic,assign) NSNumber *RSSI;//设备到手机的实时信号强度
 /**测试参数end*/
 
 /**

+ 6 - 6
RunGame/SDK/BLE/LEONBLManager.m

@@ -72,7 +72,7 @@ static LEONBLManager * instance;
  */
 - (void)scanForPeripheralsWithServices:(nullable NSArray<CBUUID *> *)serviceUUIDs options:(nullable NSDictionary<NSString *, id> *)options{
     [self.centralManager scanForPeripheralsWithServices:serviceUUIDs options:options];
-//    NSLog(@"开始扫描外设");
+    NSLog(@"开始扫描外设");
 }
 
 /**
@@ -296,23 +296,23 @@ static LEONBLManager * instance;
         if (peripheral == weakself.peripheral){
             
             if (characteristic.value.length >60){
-                
+
                 weakself.main_read = 0;
 
                 int newTs = [AlgorithmTool dataToChar:[characteristic.value subdataWithRange:NSMakeRange(54, 1)]];;//ts 时间戳
-                
+
                 self.totalPackages++;
                 int total_loss = self.tempTs - abs(newTs);
                 int abs_loss = abs(total_loss);
 //                NSLog(@"收到主设备 推送的报文 时间戳 ================ >>%d %d 【%d - %d = %d】",self.totalPackages,newTs,self.tempTs,abs(newTs),abs_loss);
-                
+
                 if (abs_loss>2){
                 self.totalLoss = self.totalLoss+(abs_loss/2-1);
 //                NSLog(@"系统api丢包 ===================================================================== >> %d %d/%d",abs_loss/2-1,self.totalLoss,self.totalPackages);
                 }
-                
+
                 self.tempTs = abs(newTs);
-                
+
             }
             
             _readValueForCharacteristicBlock(weakself.peripheral,characteristic,data,error,DEVICETYPE_MAIN);

+ 0 - 23
RunGame/SDK/BLE/MotionCountObj.h

@@ -1,23 +0,0 @@
-//
-//  MotionCountObj.h
-//  Unity-iPhone
-//
-//  Created by duowan123 on 2022/5/9.
-//
-
-#import <Foundation/Foundation.h>
-
-
-@interface MotionCountObj : NSObject
-//当局游戏动作数据
-@property(assign,nonatomic)int step;
-@property(assign,nonatomic)int jump;
-@property(assign,nonatomic)int crouch;
-@property(assign,nonatomic)int tick;
-@property(assign,nonatomic)int trample;
-@property(assign,nonatomic)int scissors;
-@property(assign,nonatomic)int rock;
-@property(assign,nonatomic)int paper;
-
-@end
-

+ 0 - 12
RunGame/SDK/BLE/MotionCountObj.m

@@ -1,12 +0,0 @@
-//
-//  MotionCountObj.m
-//  Unity-iPhone
-//
-//  Created by duowan123 on 2022/5/9.
-//
-
-#import "MotionCountObj.h"
-
-@implementation MotionCountObj
-
-@end

+ 63 - 0
RunGame/SDK/Entity /GameInfo.h

@@ -0,0 +1,63 @@
+//
+//  GameInfo.h
+//  Unity-iPhone
+//
+//  Created by duowan123 on 2022/4/28.
+//
+
+#import <Foundation/Foundation.h>
+#import "LEONBLManager.h"
+
+//#define ORIGINTRAJ 0
+//#define RUNGAME 1
+//#define DANCEGAME 2
+//#define H5GAME 3
+//#define MONSTER 4
+//#define RUINS 5
+//#define CYCLE 6
+//#define BIGFOOT 7
+//#define FINGERGUESSING 8
+//#define AEROBICS 9
+//#define KONGFU 10
+
+//游戏类型
+typedef NS_ENUM(int, GAME_TYPE){
+    GAME_TYPE_DEMO =0, //
+    GAME_TYPE_RUN, //
+    GAME_TYPE_DANCE, //
+    GAME_TYPE_H5GAME, //
+    GAME_TYPE_MONSTER, //
+    GAME_TYPE_RUINSE, //
+    GAME_TYPE_CYCLE, //
+    GAME_TYPE_BIGFOOT, //
+    GAME_TYPE_FINGERGUESSING, //
+    GAME_TYPE_AEROBICS, //
+    GAME_TYPE_KONGFU
+};
+
+@interface GameInfo : NSObject
+
+//弹窗 unity主动选择链接 主0 副1 设备
+@property(assign,nonatomic)DEVICE_TYPE deviceType;
+
+//游戏种类
+@property(assign,nonatomic)GAME_TYPE game_type;
+
+//程序在前台还是后台
+@property(assign,nonatomic)int isBackGround;
+
+//当局游戏时长
+@property(nonatomic,strong)NSDate * firstTime;
+
+//当局游戏动作数据
+@property(assign,nonatomic)int step;
+@property(assign,nonatomic)int jump;
+@property(assign,nonatomic)int crouch;
+@property(assign,nonatomic)int tick;
+@property(assign,nonatomic)int trample;
+@property(assign,nonatomic)int scissors;
+@property(assign,nonatomic)int rock;
+@property(assign,nonatomic)int paper;
+
+@end
+

+ 12 - 0
RunGame/SDK/Entity /GameInfo.m

@@ -0,0 +1,12 @@
+//
+//  GameInfo.m
+//  Unity-iPhone
+//
+//  Created by duowan123 on 2022/4/28.
+//
+
+#import "GameInfo.h"
+
+@implementation GameInfo
+
+@end

+ 33 - 0
RunGame/SDK/Entity /ShoesInfo.h

@@ -0,0 +1,33 @@
+//
+//  ShoesInfo.h
+//  Unity-iPhone
+//
+//  Created by duowan123 on 2022/4/28.
+//
+
+#import <Foundation/Foundation.h>
+
+NS_ASSUME_NONNULL_BEGIN
+
+@interface ShoesInfo : NSObject
+
+//趣动跳转过来携带的mac 实际是蓝牙设备的identity
+@property(strong,nonatomic)NSString * macAddress;
+
+//鞋子是否开启游戏模式
+@property(nonatomic,assign)BOOL gameModel;
+
+//每次从趣动跳转过来 固定一个时间戳
+@property(strong,nonatomic)NSString * timestamp;
+
+//游戏鞋子状态
+@property(assign,nonatomic)int leftStepStatus;
+@property(assign,nonatomic)int leftStepFreq;
+@property(assign,nonatomic)int leftStepCount;
+@property(assign,nonatomic)int rightStepStatus;
+@property(assign,nonatomic)int rightStepFreq;
+@property(assign,nonatomic)int rightStepCount;
+
+@end
+
+NS_ASSUME_NONNULL_END

+ 12 - 0
RunGame/SDK/Entity /ShoesInfo.m

@@ -0,0 +1,12 @@
+//
+//  ShoesInfo.m
+//  Unity-iPhone
+//
+//  Created by duowan123 on 2022/4/28.
+//
+
+#import "ShoesInfo.h"
+
+@implementation ShoesInfo
+
+@end

+ 2 - 4
RunGame/SDK/Entity /UserFriendsModel.h

@@ -10,9 +10,9 @@
 
 @interface UserFriendsModel : NSObject
 
-@property (nonatomic, assign) int code;    //为0
+@property (nonatomic, assign) int code;//为0
 
-@property (nonatomic, assign) int trans_id;    //业务id,避免关键字转换成非关键字
+@property (nonatomic, assign) int trans_id;//业务id,避免关键字转换成非关键字
 @property (nonatomic, assign) NSString * nickname;
 @property (nonatomic, assign) NSString * avatar;
 @property (nonatomic, assign) int  gender;
@@ -49,6 +49,4 @@
 
 @property (nonatomic, assign) int  position;
 
-
-
 @end

+ 3 - 7
RunGame/SDK/HTTP/HTTPDataProcession.h

@@ -17,13 +17,6 @@
 
 //#define BASE_URL @"http://shoes-api.hiyd.com"//正式环境
 #define BASE_URL @"http://test-shoes-api.hiyd.com"//测试环境
-//#define GAME_INVITE [NSString stringWithFormat:@"%@%@",BASE_URL,@"/game/invite"]
-//#define GAME_RECORD [NSString stringWithFormat:@"%@%@",BASE_URL,@"/gameRecord/addGame"]
-//#define GAME_FRIENDS [NSString stringWithFormat:@"%@%@",BASE_URL,@"/forum/friends"]
-//#define GAME_RANK [NSString stringWithFormat:@"%@%@",BASE_URL,@"/rank/game"]
-//#define GAME_START [NSString stringWithFormat:@"%@%@",BASE_URL,@"/game/start"]
-//#define GAME_END [NSString stringWithFormat:@"%@%@",BASE_URL,@"/game/end"]
-
 #define GAME_INVITE [NSString stringWithFormat:@"%@%@?v=%@&os=%@",BASE_URL,@"/game/invite",CFBundleVersion,OS]
 #define GAME_RECORD [NSString stringWithFormat:@"%@%@?v=%@&os=%@",BASE_URL,@"/gameRecord/addGame",CFBundleVersion,OS]
 #define GAME_FRIENDS [NSString stringWithFormat:@"%@%@?v=%@&os=%@",BASE_URL,@"/forum/friends",CFBundleVersion,OS]
@@ -52,18 +45,21 @@ typedef void(^GameEndDataBlock)(NSString * jsonString);//游戏结束
 */
 + (void)inviteFriends:(int)friendid info:(char*)info inviteDataBlock:(InviteDataBlock)inviteDataBlock;
 
+
 /**
 获取好友榜单数据
  @param type if (type == 0) "world" else "friend"
 */
 + (void)GetRank:(int)type rankDataBlock:(RankDataBlock)rankDataBlock;
 
+
 /**
  获取好友列表
  @param type if (type == 0) "world" else "friend"
 */
 +(void)getFriendsList:(UserFriendsDataBlock)userFriendsDataBlock;
 
+
 /**
   上传游戏数据
  @param level 等级

+ 7 - 14
RunGame/SDK/HTTP/HTTPDataProcession.m

@@ -14,7 +14,6 @@
 @implementation HTTPDataProcession
 
 #pragma mark - 网络请求数据
-/// 向网络请求数据
 + (void)getHTTPDataProcession:(NSString*)urlString token:(NSString*)token success:(SuccessBlock)successBlock fail:(FailBlock)failBlock{
     
     // 1.创建url
@@ -67,7 +66,6 @@
     
 }
 
-/// 向网络请求数据
 + (void)postHTTPDataProcession:(NSString *)urlString  withParams:(NSDictionary *)params token:(NSString*)token success:(SuccessBlock)successBlock fail:(FailBlock)failBlock{
     
       NSURL *url = [NSURL URLWithString:urlString];
@@ -114,7 +112,7 @@
         
 }
 
-//
+//字典转json字符串
 +(NSString*)getKeyValueStringWithDictionary:(NSDictionary*)dic{
     
     if (!dic||dic.count==0){
@@ -213,6 +211,7 @@
     
 }
 
+//邀请好友
 + (void)inviteFriends:(int)friendid info:(char*)info inviteDataBlock:(InviteDataBlock)inviteDataBlock{
     
     NSString * invite_user_id = [NSString stringWithFormat:@"%d",friendid];
@@ -245,6 +244,7 @@
     
 }
 
+//获取排行榜
 + (void)GetRank:(int)type rankDataBlock:(RankDataBlock)rankDataBlock{
 
     NSString * scoreType;
@@ -346,7 +346,6 @@
 
 /**
  开始游戏
- @param level 等级
 */
 +(void)gameStart{
 
@@ -380,7 +379,6 @@
 
 /**
  结束游戏
- @param level 等级
 */
 +(void)gameEnd{
     
@@ -411,6 +409,9 @@
     
 }
 
+/**
+ 上传运动数据
+*/
 +(void)postGameRecord:(int)level
                 score:(double)score
                record:(int)record
@@ -429,23 +430,15 @@
     [gameRecord setObject:[NSNumber numberWithDouble:score] forKey:@"score"];
     [gameRecord setObject:[NSNumber numberWithInt:mode] forKey:@"mode"];
    
-    //新增加时间戳字段
-    if ( [IOS_NSUSERDEFAULT objectForKey:IOSSDK_TIMESTAMP]!=nil){
-        NSString * timestamp =  [IOS_NSUSERDEFAULT objectForKey:IOSSDK_TIMESTAMP];
-        [gameRecord setObject:timestamp forKey:@"play_group"];
-    }else{
-        [gameRecord setObject:[AlgorithmTool returnTimestamp] forKey:@"play_group"];
-    }
-  
     //缓存的动作数据和持续时间
     NSDictionary * movements = [IOS_NSUSERDEFAULT objectForKey:IOSSDK_MOTIONCOUNT];
     if (movements!=nil){
-//        [sportRecord addEntriesFromDictionary:movements];
         NSDictionary * sub = movements[@"movements"];
        NSData * jsonData = [NSJSONSerialization dataWithJSONObject:sub options:NSJSONWritingPrettyPrinted error:nil];
        NSString * jsonString = [[NSString alloc] initWithData:jsonData encoding:NSUTF8StringEncoding];
         [gameRecord setObject:jsonString forKey:@"movements"];
         [gameRecord setObject:movements[@"duration"] forKey:@"duration"];
+        [gameRecord setObject:movements[@"play_group"] forKey:@"play_group"];
     }
     
     NSLog(@"gameRecord = %@",gameRecord);

+ 2 - 6
RunGame/SDK/IOSPlatformSDK.h

@@ -113,18 +113,14 @@ extern void ConnectDevice(int type);
  * 震动
  * type: 设备ID
  * duration: 时长 ms [100 .. 1000]
+ leftOrRight:针对三轮车
  */
 extern "C" {
 extern void  Vibrate(int type,int duration);
 }
 
-/**
- * 震动 -- 兼容 三轮车
- * type: 设备ID
- * duration: 时长 ms [100 .. 1000]
- */
 extern "C" {
-extern void  Vibrates(int type,int duration, int leftOrRight);
+void  Vibrates(int type,int duration,int leftOrRight);
 }
 
 /**

+ 4 - 4
RunGame/SDK/IOSPlatformSDK.mm

@@ -100,15 +100,14 @@ static IOSPlatformSDK * instance;
     static dispatch_once_t onceToken;
     dispatch_once(&onceToken, ^{
         instance = [super init];
-        //开启蓝牙
+        //初始蓝牙链接
         [BTDataProcess sharedInstance];
-        //bug监控
+        //开始bug监控
         [BugTool startAvoidBug];
     });
     return instance;
 }
 
-
 #pragma mark ============================>> public method app 跳转直链
 -(void)startWithUrl:(NSURL*)url{
     [BTDataInstance startWithUrl:url];
@@ -233,7 +232,6 @@ extern "C" {void PointerActionHandler(ActionHandler  handler){
    }
 }
 
-
 /**
  * unity call ios 主动接收 函数指针
  * UserFriendsHandler 用于ios回调 "当前用户好友列表",在👇🏻GetUserFriends中实现
@@ -299,6 +297,7 @@ void GameEnd(int level, double score, int record, int mode, int opponentId){
     [HTTPDataProcession postGameRecord:level score:score record:record mode:mode opponentId:opponentId gameEndDataBlock:^(NSString *jsonString){
         NSLog(@"IOS_SKD 回调结束游戏请求 GameEnd ===> %@",jsonString);
     }];
+    
 }
 
 /**
@@ -407,6 +406,7 @@ void InviteFriend(int friendid,char * info){
         [PopupView showCusHUDA:jsonString];
         });
     }];
+    
 }
 
 /**

二進制
RunGame/SDK/ThirdClass/.DS_Store


+ 0 - 0
DanceGame/Classes/FitfunTool/FitfunSDK_V2.0/KpSupport/SDK/HTTP/AFNetworking/AFCompatibilityMacros.h → RunGame/SDK/ThirdClass/AFNetworking/AFCompatibilityMacros.h


+ 0 - 0
DanceGame/Classes/FitfunTool/FitfunSDK_V2.0/KpSupport/SDK/HTTP/AFNetworking/AFHTTPSessionManager.h → RunGame/SDK/ThirdClass/AFNetworking/AFHTTPSessionManager.h


+ 0 - 0
DanceGame/Classes/FitfunTool/FitfunSDK_V2.0/KpSupport/SDK/HTTP/AFNetworking/AFHTTPSessionManager.m → RunGame/SDK/ThirdClass/AFNetworking/AFHTTPSessionManager.m


+ 0 - 0
DanceGame/Classes/FitfunTool/FitfunSDK_V2.0/KpSupport/SDK/HTTP/AFNetworking/AFNetworkReachabilityManager.h → RunGame/SDK/ThirdClass/AFNetworking/AFNetworkReachabilityManager.h


+ 0 - 0
DanceGame/Classes/FitfunTool/FitfunSDK_V2.0/KpSupport/SDK/HTTP/AFNetworking/AFNetworkReachabilityManager.m → RunGame/SDK/ThirdClass/AFNetworking/AFNetworkReachabilityManager.m


+ 0 - 0
DanceGame/Classes/FitfunTool/FitfunSDK_V2.0/KpSupport/SDK/HTTP/AFNetworking/AFNetworking.h → RunGame/SDK/ThirdClass/AFNetworking/AFNetworking.h


+ 0 - 0
DanceGame/Classes/FitfunTool/FitfunSDK_V2.0/KpSupport/SDK/HTTP/AFNetworking/AFSecurityPolicy.h → RunGame/SDK/ThirdClass/AFNetworking/AFSecurityPolicy.h


+ 0 - 0
DanceGame/Classes/FitfunTool/FitfunSDK_V2.0/KpSupport/SDK/HTTP/AFNetworking/AFSecurityPolicy.m → RunGame/SDK/ThirdClass/AFNetworking/AFSecurityPolicy.m


+ 0 - 0
DanceGame/Classes/FitfunTool/FitfunSDK_V2.0/KpSupport/SDK/HTTP/AFNetworking/AFURLRequestSerialization.h → RunGame/SDK/ThirdClass/AFNetworking/AFURLRequestSerialization.h


+ 0 - 0
DanceGame/Classes/FitfunTool/FitfunSDK_V2.0/KpSupport/SDK/HTTP/AFNetworking/AFURLRequestSerialization.m → RunGame/SDK/ThirdClass/AFNetworking/AFURLRequestSerialization.m


+ 0 - 0
DanceGame/Classes/FitfunTool/FitfunSDK_V2.0/KpSupport/SDK/HTTP/AFNetworking/AFURLResponseSerialization.h → RunGame/SDK/ThirdClass/AFNetworking/AFURLResponseSerialization.h


+ 0 - 0
DanceGame/Classes/FitfunTool/FitfunSDK_V2.0/KpSupport/SDK/HTTP/AFNetworking/AFURLResponseSerialization.m → RunGame/SDK/ThirdClass/AFNetworking/AFURLResponseSerialization.m


+ 0 - 0
DanceGame/Classes/FitfunTool/FitfunSDK_V2.0/KpSupport/SDK/HTTP/AFNetworking/AFURLSessionManager.h → RunGame/SDK/ThirdClass/AFNetworking/AFURLSessionManager.h


+ 0 - 0
DanceGame/Classes/FitfunTool/FitfunSDK_V2.0/KpSupport/SDK/HTTP/AFNetworking/AFURLSessionManager.m → RunGame/SDK/ThirdClass/AFNetworking/AFURLSessionManager.m


二進制
RunGame/SDK/ThirdClass/AvoidCrash-master/.DS_Store


二進制
RunGame/SDK/ThirdClass/AvoidCrash-master/AvoidCrashDemo/.DS_Store


+ 116 - 0
RunGame/SDK/ThirdClass/AvoidCrash/AvoidCrash.h

@@ -0,0 +1,116 @@
+//
+//  AvoidCrash.h
+//  https://github.com/chenfanfang/AvoidCrash
+//
+//  Created by mac on 16/9/21.
+//  Copyright © 2016年 chenfanfang. All rights reserved.
+//
+
+//===================================================
+//   使用方法和注意事项:
+//   https://www.jianshu.com/p/2b90aa96c0a0
+//===================================================
+
+#import <Foundation/Foundation.h>
+#import <objc/runtime.h>
+
+//category
+#import "NSObject+AvoidCrash.h"
+
+#import "NSArray+AvoidCrash.h"
+#import "NSMutableArray+AvoidCrash.h"
+
+#import "NSDictionary+AvoidCrash.h"
+#import "NSMutableDictionary+AvoidCrash.h"
+
+#import "NSString+AvoidCrash.h"
+#import "NSMutableString+AvoidCrash.h"
+
+#import "NSAttributedString+AvoidCrash.h"
+#import "NSMutableAttributedString+AvoidCrash.h"
+
+//define
+#import "AvoidCrashStubProxy.h"
+
+
+
+
+
+@interface AvoidCrash : NSObject
+
+//===================================================
+//   使用方法和注意事项:
+//   https://www.jianshu.com/p/2b90aa96c0a0
+//===================================================
+
+
+
+/**
+ *  
+ *  开始生效.你可以在AppDelegate的didFinishLaunchingWithOptions方法中调用becomeEffective方法
+ *  【默认不开启  对”unrecognized selector sent to instance”防止崩溃的处理】
+ *
+ *  这是全局生效,若你只需要部分生效,你可以单个进行处理,比如:
+ *  [NSArray avoidCrashExchangeMethod];
+ *  [NSMutableArray avoidCrashExchangeMethod];
+ *  .................
+ *  .................
+ *
+ */
++ (void)becomeEffective;
+
+
+/** 
+ *  相比于becomeEffective,增加
+ *  对”unrecognized selector sent to instance”防止崩溃的处理
+ *
+ *  但是必须配合:
+ *            setupClassStringsArr:和
+ *            setupNoneSelClassStringPrefixsArr
+ *            这两个方法可以同时使用
+ */
++ (void)makeAllEffective;
+
+
+
+/** 
+ *  初始化一个需要防止”unrecognized selector sent to instance”的崩溃的类名数组
+ *  ⚠️不可将@"NSObject"加入classStrings数组中
+ *  ⚠️不可将UI前缀的字符串加入classStrings数组中
+ */
++ (void)setupNoneSelClassStringsArr:(NSArray<NSString *> *)classStrings;
+
+
+/**
+ *  初始化一个需要防止”unrecognized selector sent to instance”的崩溃的类名前缀的数组
+ *  ⚠️不可将UI前缀的字符串(包括@"UI")加入classStringPrefixs数组中
+ *  ⚠️不可将NS前缀的字符串(包括@"NS")加入classStringPrefixs数组中
+ */
++ (void)setupNoneSelClassStringPrefixsArr:(NSArray<NSString *> *)classStringPrefixs;
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+//您可以忽略以下方法
+
++ (void)exchangeClassMethod:(Class)anClass method1Sel:(SEL)method1Sel method2Sel:(SEL)method2Sel;
+
++ (void)exchangeInstanceMethod:(Class)anClass method1Sel:(SEL)method1Sel method2Sel:(SEL)method2Sel;
+
++ (void)noteErrorWithException:(NSException *)exception defaultToDo:(NSString *)defaultToDo;
+
+
+@end

+ 220 - 0
RunGame/SDK/ThirdClass/AvoidCrash/AvoidCrash.m

@@ -0,0 +1,220 @@
+//
+//  AvoidCrash.m
+//  https://github.com/chenfanfang/AvoidCrash
+//
+//  Created by mac on 16/9/21.
+//  Copyright © 2016年 chenfanfang. All rights reserved.
+//
+
+#import "AvoidCrash.h"
+
+
+
+
+#define key_errorName        @"errorName"
+#define key_errorReason      @"errorReason"
+#define key_errorPlace       @"errorPlace"
+#define key_defaultToDo      @"defaultToDo"
+#define key_callStackSymbols @"callStackSymbols"
+#define key_exception        @"exception"
+
+
+@implementation AvoidCrash
+
+
++ (void)becomeEffective {
+    [self effectiveIfDealWithNoneSel:NO];
+    
+}
+
++ (void)makeAllEffective {
+    [self effectiveIfDealWithNoneSel:YES];
+}
+
++ (void)effectiveIfDealWithNoneSel:(BOOL)dealWithNoneSel {
+    static dispatch_once_t onceToken;
+    dispatch_once(&onceToken, ^{
+        
+        [NSObject avoidCrashExchangeMethodIfDealWithNoneSel:dealWithNoneSel];
+        
+        [NSArray avoidCrashExchangeMethod];
+        [NSMutableArray avoidCrashExchangeMethod];
+        
+        [NSDictionary avoidCrashExchangeMethod];
+        [NSMutableDictionary avoidCrashExchangeMethod];
+        
+        [NSString avoidCrashExchangeMethod];
+        [NSMutableString avoidCrashExchangeMethod];
+        
+        [NSAttributedString avoidCrashExchangeMethod];
+        [NSMutableAttributedString avoidCrashExchangeMethod];
+        
+    });
+}
+
++ (void)setupNoneSelClassStringsArr:(NSArray<NSString *> *)classStrings {
+    [NSObject setupNoneSelClassStringsArr:classStrings];
+}
+
+/**
+ *  初始化一个需要防止”unrecognized selector sent to instance”的崩溃的类名前缀的数组
+ */
++ (void)setupNoneSelClassStringPrefixsArr:(NSArray<NSString *> *)classStringPrefixs {
+    [NSObject setupNoneSelClassStringPrefixsArr:classStringPrefixs];
+}
+
+
+/**
+ *  类方法的交换
+ *
+ *  @param anClass    哪个类
+ *  @param method1Sel 方法1
+ *  @param method2Sel 方法2
+ */
++ (void)exchangeClassMethod:(Class)anClass method1Sel:(SEL)method1Sel method2Sel:(SEL)method2Sel {
+    Method method1 = class_getClassMethod(anClass, method1Sel);
+    Method method2 = class_getClassMethod(anClass, method2Sel);
+    method_exchangeImplementations(method1, method2);
+}
+
+
+/**
+ *  对象方法的交换
+ *
+ *  @param anClass    哪个类
+ *  @param method1Sel 方法1(原本的方法)
+ *  @param method2Sel 方法2(要替换成的方法)
+ */
++ (void)exchangeInstanceMethod:(Class)anClass method1Sel:(SEL)method1Sel method2Sel:(SEL)method2Sel {
+    
+    
+    Method originalMethod = class_getInstanceMethod(anClass, method1Sel);
+    Method swizzledMethod = class_getInstanceMethod(anClass, method2Sel);
+    
+    BOOL didAddMethod =
+    class_addMethod(anClass,
+                    method1Sel,
+                    method_getImplementation(swizzledMethod),
+                    method_getTypeEncoding(swizzledMethod));
+    
+    if (didAddMethod) {
+        class_replaceMethod(anClass,
+                            method2Sel,
+                            method_getImplementation(originalMethod),
+                            method_getTypeEncoding(originalMethod));
+    }
+    
+    else {
+        method_exchangeImplementations(originalMethod, swizzledMethod);
+    }
+    
+}
+
+
+
+/**
+ *  获取堆栈主要崩溃精简化的信息<根据正则表达式匹配出来>
+ *
+ *  @param callStackSymbols 堆栈主要崩溃信息
+ *
+ *  @return 堆栈主要崩溃精简化的信息
+ */
+
++ (NSString *)getMainCallStackSymbolMessageWithCallStackSymbols:(NSArray<NSString *> *)callStackSymbols {
+    
+    //mainCallStackSymbolMsg的格式为   +[类名 方法名]  或者 -[类名 方法名]
+    __block NSString *mainCallStackSymbolMsg = nil;
+    
+    //匹配出来的格式为 +[类名 方法名]  或者 -[类名 方法名]
+    NSString *regularExpStr = @"[-\\+]\\[.+\\]";
+    
+    
+    NSRegularExpression *regularExp = [[NSRegularExpression alloc] initWithPattern:regularExpStr options:NSRegularExpressionCaseInsensitive error:nil];
+    
+    
+    for (int index = 2; index < callStackSymbols.count; index++) {
+        NSString *callStackSymbol = callStackSymbols[index];
+        
+        [regularExp enumerateMatchesInString:callStackSymbol options:NSMatchingReportProgress range:NSMakeRange(0, callStackSymbol.length) usingBlock:^(NSTextCheckingResult * _Nullable result, NSMatchingFlags flags, BOOL * _Nonnull stop) {
+            if (result) {
+                NSString* tempCallStackSymbolMsg = [callStackSymbol substringWithRange:result.range];
+                
+                //get className
+                NSString *className = [tempCallStackSymbolMsg componentsSeparatedByString:@" "].firstObject;
+                className = [className componentsSeparatedByString:@"["].lastObject;
+                
+                NSBundle *bundle = [NSBundle bundleForClass:NSClassFromString(className)];
+                
+                //filter category and system class
+                if (![className hasSuffix:@")"] && bundle == [NSBundle mainBundle]) {
+                    mainCallStackSymbolMsg = tempCallStackSymbolMsg;
+                    
+                }
+                *stop = YES;
+            }
+        }];
+        
+        if (mainCallStackSymbolMsg.length) {
+            break;
+        }
+    }
+    
+    return mainCallStackSymbolMsg;
+}
+
+
+/**
+ *  提示崩溃的信息(控制台输出、通知)
+ *
+ *  @param exception   捕获到的异常
+ *  @param defaultToDo 这个框架里默认的做法
+ */
++ (void)noteErrorWithException:(NSException *)exception defaultToDo:(NSString *)defaultToDo {
+
+    //堆栈数据
+    NSArray *callStackSymbolsArr = [NSThread callStackSymbols];
+    
+    //获取在哪个类的哪个方法中实例化的数组  字符串格式 -[类名 方法名]  或者 +[类名 方法名]
+    NSString *mainCallStackSymbolMsg = [AvoidCrash getMainCallStackSymbolMessageWithCallStackSymbols:callStackSymbolsArr];
+    
+    if (mainCallStackSymbolMsg == nil) {
+        
+        mainCallStackSymbolMsg = @"崩溃方法定位失败,请您查看函数调用栈来排查错误原因";
+        
+    }
+    
+    NSString *errorName = exception.name;
+    NSString *errorReason = exception.reason;
+    //errorReason 可能为 -[__NSCFConstantString avoidCrashCharacterAtIndex:]: Range or index out of bounds
+    //将avoidCrash去掉
+    errorReason = [errorReason stringByReplacingOccurrencesOfString:@"avoidCrash" withString:@""];
+    
+    NSString *errorPlace = [NSString stringWithFormat:@"Error Place:%@",mainCallStackSymbolMsg];
+    
+    NSString *logErrorMessage = [NSString stringWithFormat:@"\n\n%@\n\n%@\n%@\n%@\n%@",AvoidCrashSeparatorWithFlag, errorName, errorReason, errorPlace, defaultToDo];
+    
+    logErrorMessage = [NSString stringWithFormat:@"%@\n\n%@\n\n",logErrorMessage,AvoidCrashSeparator];
+    AvoidCrashLog(@"%@",logErrorMessage);
+    
+    
+    //请忽略下面的赋值,目的只是为了能顺利上传到cocoapods
+    logErrorMessage = logErrorMessage;
+    
+    NSDictionary *errorInfoDic = @{
+                                   key_errorName        : errorName,
+                                   key_errorReason      : errorReason,
+                                   key_errorPlace       : errorPlace,
+                                   key_defaultToDo      : defaultToDo,
+                                   key_exception        : exception,
+                                   key_callStackSymbols : callStackSymbolsArr
+                                   };
+    
+    //将错误信息放在字典里,用通知的形式发送出去
+    dispatch_async(dispatch_get_main_queue(), ^{
+        [[NSNotificationCenter defaultCenter] postNotificationName:AvoidCrashNotification object:nil userInfo:errorInfoDic];
+    });
+}
+
+
+
+@end

+ 17 - 0
RunGame/SDK/ThirdClass/AvoidCrash/AvoidCrashProtocol.h

@@ -0,0 +1,17 @@
+//
+//  AvoidCrashProtocol.h
+//  https://github.com/chenfanfang/AvoidCrash
+//
+//  Created by chenfanfang on 2017/7/22.
+//  Copyright © 2017年 chenfanfang. All rights reserved.
+//
+
+#import <UIKit/UIKit.h>
+
+
+@protocol AvoidCrashProtocol <NSObject>
+
+@required
++ (void)avoidCrashExchangeMethod;
+
+@end

+ 37 - 0
RunGame/SDK/ThirdClass/AvoidCrash/AvoidCrashStubProxy.h

@@ -0,0 +1,37 @@
+//
+//  AvoidCrashStubProxy.h
+//  https://github.com/chenfanfang/AvoidCrash
+//
+//  Created by chenfanfang on 2017/7/25.
+//  Copyright © 2017年 chenfanfang. All rights reserved.
+//
+
+#import <Foundation/Foundation.h>
+
+
+#define AvoidCrashNotification @"AvoidCrashNotification"
+#define AvoidCrashIsiOS(version) ([[UIDevice currentDevice].systemVersion floatValue] >= version)
+
+
+//user can ignore below define
+#define AvoidCrashDefaultReturnNil  @"AvoidCrash default is to return nil to avoid crash."
+#define AvoidCrashDefaultIgnore     @"AvoidCrash default is to ignore this operation to avoid crash."
+
+#define AvoidCrashSeparator         @"================================================================"
+#define AvoidCrashSeparatorWithFlag @"========================AvoidCrash Log=========================="
+
+
+#ifdef DEBUG
+
+#define  AvoidCrashLog(...) NSLog(@"%@",[NSString stringWithFormat:__VA_ARGS__])
+
+#else
+
+#define AvoidCrashLog(...)
+#endif
+
+@interface AvoidCrashStubProxy : NSObject
+
+- (void)proxyMethod;
+
+@end

+ 18 - 0
RunGame/SDK/ThirdClass/AvoidCrash/AvoidCrashStubProxy.m

@@ -0,0 +1,18 @@
+//
+//  AvoidCrashStubProxy.m
+//  https://github.com/chenfanfang/AvoidCrash
+//
+//  Created by chenfanfang on 2017/7/25.
+//  Copyright © 2017年 chenfanfang. All rights reserved.
+//
+
+#import "AvoidCrashStubProxy.h"
+
+
+@implementation AvoidCrashStubProxy
+
+- (void)proxyMethod {
+    
+}
+
+@end

+ 25 - 0
RunGame/SDK/ThirdClass/AvoidCrash/NSArray+AvoidCrash.h

@@ -0,0 +1,25 @@
+//
+//  NSArray+AvoidCrash.h
+//  https://github.com/chenfanfang/AvoidCrash
+//
+//  Created by mac on 16/9/21.
+//  Copyright © 2016年 chenfanfang. All rights reserved.
+//
+
+#import <Foundation/Foundation.h>
+#import "AvoidCrashProtocol.h"
+
+@interface NSArray (AvoidCrash)<AvoidCrashProtocol>
+
+
+@end
+
+
+/**
+ *  Can avoid crash method
+ *
+ *  1. NSArray的快速创建方式 NSArray *array = @[@"chenfanfang", @"AvoidCrash"];  //这种创建方式其实调用的是2中的方法
+ *  2. +(instancetype)arrayWithObjects:(const id  _Nonnull __unsafe_unretained *)objects count:(NSUInteger)cnt
+ *  3. - (id)objectAtIndex:(NSUInteger)index
+ *  4. - (void)getObjects:(__unsafe_unretained id  _Nonnull *)objects range:(NSRange)range
+ */    

+ 258 - 0
RunGame/SDK/ThirdClass/AvoidCrash/NSArray+AvoidCrash.m

@@ -0,0 +1,258 @@
+//
+//  NSArray+AvoidCrash.m
+//  https://github.com/chenfanfang/AvoidCrash
+//
+//  Created by mac on 16/9/21.
+//  Copyright © 2016年 chenfanfang. All rights reserved.
+//
+
+#import "NSArray+AvoidCrash.h"
+
+#import "AvoidCrash.h"
+
+@implementation NSArray (AvoidCrash)
+
+
++ (void)avoidCrashExchangeMethod {
+    
+    static dispatch_once_t onceToken;
+    dispatch_once(&onceToken, ^{
+        //=================
+        //   class method
+        //=================
+        
+        //instance array method exchange
+        [AvoidCrash exchangeClassMethod:[self class] method1Sel:@selector(arrayWithObjects:count:) method2Sel:@selector(AvoidCrashArrayWithObjects:count:)];
+        
+        
+        
+        //====================
+        //   instance method
+        //====================
+        
+        Class __NSArray = NSClassFromString(@"NSArray");
+        Class __NSArrayI = NSClassFromString(@"__NSArrayI");
+        Class __NSSingleObjectArrayI = NSClassFromString(@"__NSSingleObjectArrayI");
+        Class __NSArray0 = NSClassFromString(@"__NSArray0");
+        
+        
+        //objectsAtIndexes:
+        [AvoidCrash exchangeInstanceMethod:__NSArray method1Sel:@selector(objectsAtIndexes:) method2Sel:@selector(avoidCrashObjectsAtIndexes:)];
+        
+        
+        //objectAtIndex:
+        
+        [AvoidCrash exchangeInstanceMethod:__NSArrayI method1Sel:@selector(objectAtIndex:) method2Sel:@selector(__NSArrayIAvoidCrashObjectAtIndex:)];
+        
+        [AvoidCrash exchangeInstanceMethod:__NSSingleObjectArrayI method1Sel:@selector(objectAtIndex:) method2Sel:@selector(__NSSingleObjectArrayIAvoidCrashObjectAtIndex:)];
+        
+        [AvoidCrash exchangeInstanceMethod:__NSArray0 method1Sel:@selector(objectAtIndex:) method2Sel:@selector(__NSArray0AvoidCrashObjectAtIndex:)];
+        
+        //objectAtIndexedSubscript:
+        if (AvoidCrashIsiOS(11.0)) {
+            [AvoidCrash exchangeInstanceMethod:__NSArrayI method1Sel:@selector(objectAtIndexedSubscript:) method2Sel:@selector(__NSArrayIAvoidCrashObjectAtIndexedSubscript:)];
+        }
+        
+        
+        //getObjects:range:
+        [AvoidCrash exchangeInstanceMethod:__NSArray method1Sel:@selector(getObjects:range:) method2Sel:@selector(NSArrayAvoidCrashGetObjects:range:)];
+        
+        [AvoidCrash exchangeInstanceMethod:__NSSingleObjectArrayI method1Sel:@selector(getObjects:range:) method2Sel:@selector(__NSSingleObjectArrayIAvoidCrashGetObjects:range:)];
+        
+        [AvoidCrash exchangeInstanceMethod:__NSArrayI method1Sel:@selector(getObjects:range:) method2Sel:@selector(__NSArrayIAvoidCrashGetObjects:range:)];
+    });
+    
+    
+}
+
+
+//=================================================================
+//                        instance array
+//=================================================================
+#pragma mark - instance array
+
+
++ (instancetype)AvoidCrashArrayWithObjects:(const id  _Nonnull __unsafe_unretained *)objects count:(NSUInteger)cnt {
+    
+    id instance = nil;
+    
+    @try {
+        instance = [self AvoidCrashArrayWithObjects:objects count:cnt];
+    }
+    @catch (NSException *exception) {
+        
+        NSString *defaultToDo = @"AvoidCrash default is to remove nil object and instance a array.";
+        [AvoidCrash noteErrorWithException:exception defaultToDo:defaultToDo];
+        
+        //以下是对错误数据的处理,把为nil的数据去掉,然后初始化数组
+        NSInteger newObjsIndex = 0;
+        id  _Nonnull __unsafe_unretained newObjects[cnt];
+        
+        for (int i = 0; i < cnt; i++) {
+            if (objects[i] != nil) {
+                newObjects[newObjsIndex] = objects[i];
+                newObjsIndex++;
+            }
+        }
+        instance = [self AvoidCrashArrayWithObjects:newObjects count:newObjsIndex];
+    }
+    @finally {
+        return instance;
+    }
+}
+
+
+
+//=================================================================
+//                     objectAtIndexedSubscript:
+//=================================================================
+#pragma mark - objectAtIndexedSubscript:
+- (id)__NSArrayIAvoidCrashObjectAtIndexedSubscript:(NSUInteger)idx {
+    id object = nil;
+    
+    @try {
+        object = [self __NSArrayIAvoidCrashObjectAtIndexedSubscript:idx];
+    }
+    @catch (NSException *exception) {
+        NSString *defaultToDo = AvoidCrashDefaultReturnNil;
+        [AvoidCrash noteErrorWithException:exception defaultToDo:defaultToDo];
+    }
+    @finally {
+        return object;
+    }
+
+}
+
+
+//=================================================================
+//                       objectsAtIndexes:
+//=================================================================
+#pragma mark - objectsAtIndexes:
+
+- (NSArray *)avoidCrashObjectsAtIndexes:(NSIndexSet *)indexes {
+    
+    NSArray *returnArray = nil;
+    @try {
+        returnArray = [self avoidCrashObjectsAtIndexes:indexes];
+    } @catch (NSException *exception) {
+        NSString *defaultToDo = AvoidCrashDefaultReturnNil;
+        [AvoidCrash noteErrorWithException:exception defaultToDo:defaultToDo];
+        
+    } @finally {
+        return returnArray;
+    }
+}
+
+
+//=================================================================
+//                         objectAtIndex:
+//=================================================================
+#pragma mark - objectAtIndex:
+
+//__NSArrayI  objectAtIndex:
+- (id)__NSArrayIAvoidCrashObjectAtIndex:(NSUInteger)index {
+    id object = nil;
+    
+    @try {
+        object = [self __NSArrayIAvoidCrashObjectAtIndex:index];
+    }
+    @catch (NSException *exception) {
+        NSString *defaultToDo = AvoidCrashDefaultReturnNil;
+        [AvoidCrash noteErrorWithException:exception defaultToDo:defaultToDo];
+    }
+    @finally {
+        return object;
+    }
+}
+
+
+
+//__NSSingleObjectArrayI objectAtIndex:
+- (id)__NSSingleObjectArrayIAvoidCrashObjectAtIndex:(NSUInteger)index {
+    id object = nil;
+    
+    @try {
+        object = [self __NSSingleObjectArrayIAvoidCrashObjectAtIndex:index];
+    }
+    @catch (NSException *exception) {
+        NSString *defaultToDo = AvoidCrashDefaultReturnNil;
+        [AvoidCrash noteErrorWithException:exception defaultToDo:defaultToDo];
+    }
+    @finally {
+        return object;
+    }
+}
+
+//__NSArray0 objectAtIndex:
+- (id)__NSArray0AvoidCrashObjectAtIndex:(NSUInteger)index {
+    id object = nil;
+    
+    @try {
+        object = [self __NSArray0AvoidCrashObjectAtIndex:index];
+    }
+    @catch (NSException *exception) {
+        NSString *defaultToDo = AvoidCrashDefaultReturnNil;
+        [AvoidCrash noteErrorWithException:exception defaultToDo:defaultToDo];
+    }
+    @finally {
+        return object;
+    }
+}
+
+
+//=================================================================
+//                           getObjects:range:
+//=================================================================
+#pragma mark - getObjects:range:
+
+//NSArray getObjects:range:
+- (void)NSArrayAvoidCrashGetObjects:(__unsafe_unretained id  _Nonnull *)objects range:(NSRange)range {
+    
+    @try {
+        [self NSArrayAvoidCrashGetObjects:objects range:range];
+    } @catch (NSException *exception) {
+        
+        NSString *defaultToDo = AvoidCrashDefaultIgnore;
+        [AvoidCrash noteErrorWithException:exception defaultToDo:defaultToDo];
+        
+    } @finally {
+        
+    }
+}
+
+
+//__NSSingleObjectArrayI  getObjects:range:
+- (void)__NSSingleObjectArrayIAvoidCrashGetObjects:(__unsafe_unretained id  _Nonnull *)objects range:(NSRange)range {
+    
+    @try {
+        [self __NSSingleObjectArrayIAvoidCrashGetObjects:objects range:range];
+    } @catch (NSException *exception) {
+        
+        NSString *defaultToDo = AvoidCrashDefaultIgnore;
+        [AvoidCrash noteErrorWithException:exception defaultToDo:defaultToDo];
+        
+    } @finally {
+        
+    }
+}
+
+
+//__NSArrayI  getObjects:range:
+- (void)__NSArrayIAvoidCrashGetObjects:(__unsafe_unretained id  _Nonnull *)objects range:(NSRange)range {
+    
+    @try {
+        [self __NSArrayIAvoidCrashGetObjects:objects range:range];
+    } @catch (NSException *exception) {
+        
+        NSString *defaultToDo = AvoidCrashDefaultIgnore;
+        [AvoidCrash noteErrorWithException:exception defaultToDo:defaultToDo];
+        
+    } @finally {
+        
+    }
+}
+
+
+
+
+@end

+ 25 - 0
RunGame/SDK/ThirdClass/AvoidCrash/NSAttributedString+AvoidCrash.h

@@ -0,0 +1,25 @@
+//
+//  NSAttributedString+AvoidCrash.h
+//  https://github.com/chenfanfang/AvoidCrash
+//
+//  Created by mac on 16/10/15.
+//  Copyright © 2016年 chenfanfang. All rights reserved.
+//
+
+#import <Foundation/Foundation.h>
+#import "AvoidCrashProtocol.h"
+
+@interface NSAttributedString (AvoidCrash)<AvoidCrashProtocol>
+
+
+@end
+
+/**
+ *  Can avoid crash method
+ *
+ *  1.- (instancetype)initWithString:(NSString *)str
+ *  2.- (instancetype)initWithAttributedString:(NSAttributedString *)attrStr
+ *  3.- (instancetype)initWithString:(NSString *)str attributes:(NSDictionary<NSString *,id> *)attrs
+ *
+ *
+ */

+ 96 - 0
RunGame/SDK/ThirdClass/AvoidCrash/NSAttributedString+AvoidCrash.m

@@ -0,0 +1,96 @@
+//
+//  NSAttributedString+AvoidCrash.m
+//  https://github.com/chenfanfang/AvoidCrash
+//
+//  Created by mac on 16/10/15.
+//  Copyright © 2016年 chenfanfang. All rights reserved.
+//
+
+#import "NSAttributedString+AvoidCrash.h"
+
+#import "AvoidCrash.h"
+
+@implementation NSAttributedString (AvoidCrash)
+
++ (void)avoidCrashExchangeMethod {
+    
+    static dispatch_once_t onceToken;
+    dispatch_once(&onceToken, ^{
+        
+        Class NSConcreteAttributedString = NSClassFromString(@"NSConcreteAttributedString");
+        
+        //initWithString:
+        [AvoidCrash exchangeInstanceMethod:NSConcreteAttributedString method1Sel:@selector(initWithString:) method2Sel:@selector(avoidCrashInitWithString:)];
+        
+        //initWithAttributedString
+        [AvoidCrash exchangeInstanceMethod:NSConcreteAttributedString method1Sel:@selector(initWithAttributedString:) method2Sel:@selector(avoidCrashInitWithAttributedString:)];
+        
+        //initWithString:attributes:
+        [AvoidCrash exchangeInstanceMethod:NSConcreteAttributedString method1Sel:@selector(initWithString:attributes:) method2Sel:@selector(avoidCrashInitWithString:attributes:)];
+    });
+
+}
+
+//=================================================================
+//                           initWithString:
+//=================================================================
+#pragma mark - initWithString:
+
+- (instancetype)avoidCrashInitWithString:(NSString *)str {
+    id object = nil;
+    
+    @try {
+        object = [self avoidCrashInitWithString:str];
+    }
+    @catch (NSException *exception) {
+        NSString *defaultToDo = AvoidCrashDefaultReturnNil;
+        [AvoidCrash noteErrorWithException:exception defaultToDo:defaultToDo];
+    }
+    @finally {
+        return object;
+    }
+}
+
+
+//=================================================================
+//                          initWithAttributedString
+//=================================================================
+#pragma mark - initWithAttributedString
+
+- (instancetype)avoidCrashInitWithAttributedString:(NSAttributedString *)attrStr {
+    id object = nil;
+    
+    @try {
+        object = [self avoidCrashInitWithAttributedString:attrStr];
+    }
+    @catch (NSException *exception) {
+        NSString *defaultToDo = AvoidCrashDefaultReturnNil;
+        [AvoidCrash noteErrorWithException:exception defaultToDo:defaultToDo];
+    }
+    @finally {
+        return object;
+    }
+}
+
+
+//=================================================================
+//                      initWithString:attributes:
+//=================================================================
+#pragma mark - initWithString:attributes:
+
+- (instancetype)avoidCrashInitWithString:(NSString *)str attributes:(NSDictionary<NSString *,id> *)attrs {
+    id object = nil;
+    
+    @try {
+        object = [self avoidCrashInitWithString:str attributes:attrs];
+    }
+    @catch (NSException *exception) {
+        NSString *defaultToDo = AvoidCrashDefaultReturnNil;
+        [AvoidCrash noteErrorWithException:exception defaultToDo:defaultToDo];
+    }
+    @finally {
+        return object;
+    }
+}
+
+@end

+ 24 - 0
RunGame/SDK/ThirdClass/AvoidCrash/NSDictionary+AvoidCrash.h

@@ -0,0 +1,24 @@
+//
+//  NSDictionary+AvoidCrash.h
+//  https://github.com/chenfanfang/AvoidCrash
+//
+//  Created by mac on 16/9/21.
+//  Copyright © 2016年 chenfanfang. All rights reserved.
+//
+
+#import <Foundation/Foundation.h>
+#import "AvoidCrashProtocol.h"
+
+@interface NSDictionary (AvoidCrash)<AvoidCrashProtocol>
+
+
+@end
+
+
+/**
+ *  Can avoid crash method
+ *
+ *  1. NSDictionary的快速创建方式 NSDictionary *dict = @{@"frameWork" : @"AvoidCrash"}; //这种创建方式其实调用的是2中的方法
+ *  2. +(instancetype)dictionaryWithObjects:(const id  _Nonnull __unsafe_unretained *)objects forKeys:(const id<NSCopying>  _Nonnull __unsafe_unretained *)keys count:(NSUInteger)cnt
+ *
+ */

+ 56 - 0
RunGame/SDK/ThirdClass/AvoidCrash/NSDictionary+AvoidCrash.m

@@ -0,0 +1,56 @@
+//
+//  NSDictionary+AvoidCrash.m
+//  https://github.com/chenfanfang/AvoidCrash
+//
+//  Created by mac on 16/9/21.
+//  Copyright © 2016年 chenfanfang. All rights reserved.
+//
+
+#import "NSDictionary+AvoidCrash.h"
+
+#import "AvoidCrash.h"
+
+@implementation NSDictionary (AvoidCrash)
+
++ (void)avoidCrashExchangeMethod {
+    
+    static dispatch_once_t onceToken;
+    dispatch_once(&onceToken, ^{
+        
+        [AvoidCrash exchangeClassMethod:self method1Sel:@selector(dictionaryWithObjects:forKeys:count:) method2Sel:@selector(avoidCrashDictionaryWithObjects:forKeys:count:)];
+    });
+}
+
+
++ (instancetype)avoidCrashDictionaryWithObjects:(const id  _Nonnull __unsafe_unretained *)objects forKeys:(const id<NSCopying>  _Nonnull __unsafe_unretained *)keys count:(NSUInteger)cnt {
+    
+    id instance = nil;
+    
+    @try {
+        instance = [self avoidCrashDictionaryWithObjects:objects forKeys:keys count:cnt];
+    }
+    @catch (NSException *exception) {
+        
+        NSString *defaultToDo = @"AvoidCrash default is to remove nil key-values and instance a dictionary.";
+        [AvoidCrash noteErrorWithException:exception defaultToDo:defaultToDo];
+        
+        //处理错误的数据,然后重新初始化一个字典
+        NSUInteger index = 0;
+        id  _Nonnull __unsafe_unretained newObjects[cnt];
+        id  _Nonnull __unsafe_unretained newkeys[cnt];
+        
+        for (int i = 0; i < cnt; i++) {
+            if (objects[i] && keys[i]) {
+                newObjects[index] = objects[i];
+                newkeys[index] = keys[i];
+                index++;
+            }
+        }
+        instance = [self avoidCrashDictionaryWithObjects:newObjects forKeys:newkeys count:index];
+    }
+    @finally {
+        return instance;
+    }
+}
+
+@end

+ 26 - 0
RunGame/SDK/ThirdClass/AvoidCrash/NSMutableArray+AvoidCrash.h

@@ -0,0 +1,26 @@
+//
+//  NSMutableArray+AvoidCrash.h
+//  https://github.com/chenfanfang/AvoidCrash
+//
+//  Created by mac on 16/9/21.
+//  Copyright © 2016年 chenfanfang. All rights reserved.
+//
+
+#import <Foundation/Foundation.h>
+#import "AvoidCrashProtocol.h"
+
+@interface NSMutableArray (AvoidCrash)<AvoidCrashProtocol>
+
+
+@end
+
+
+/**
+ *  Can avoid crash method
+ *
+ *  1. - (id)objectAtIndex:(NSUInteger)index
+ *  2. - (void)setObject:(id)obj atIndexedSubscript:(NSUInteger)idx
+ *  3. - (void)removeObjectAtIndex:(NSUInteger)index
+ *  4. - (void)insertObject:(id)anObject atIndex:(NSUInteger)index
+ *  5. - (void)getObjects:(__unsafe_unretained id  _Nonnull *)objects range:(NSRange)range
+ */

+ 169 - 0
RunGame/SDK/ThirdClass/AvoidCrash/NSMutableArray+AvoidCrash.m

@@ -0,0 +1,169 @@
+//
+//  NSMutableArray+AvoidCrash.m
+//  https://github.com/chenfanfang/AvoidCrash
+//
+//  Created by mac on 16/9/21.
+//  Copyright © 2016年 chenfanfang. All rights reserved.
+//
+
+#import "NSMutableArray+AvoidCrash.h"
+
+#import "AvoidCrash.h"
+
+@implementation NSMutableArray (AvoidCrash)
+
++ (void)avoidCrashExchangeMethod {
+    
+    static dispatch_once_t onceToken;
+    dispatch_once(&onceToken, ^{
+        
+        Class arrayMClass = NSClassFromString(@"__NSArrayM");
+        
+        
+        //objectAtIndex:
+        [AvoidCrash exchangeInstanceMethod:arrayMClass method1Sel:@selector(objectAtIndex:) method2Sel:@selector(avoidCrashObjectAtIndex:)];
+        
+        //objectAtIndexedSubscript
+        if (AvoidCrashIsiOS(11.0)) {
+            [AvoidCrash exchangeInstanceMethod:arrayMClass method1Sel:@selector(objectAtIndexedSubscript:) method2Sel:@selector(avoidCrashObjectAtIndexedSubscript:)];
+        }
+        
+        
+        //setObject:atIndexedSubscript:
+        [AvoidCrash exchangeInstanceMethod:arrayMClass method1Sel:@selector(setObject:atIndexedSubscript:) method2Sel:@selector(avoidCrashSetObject:atIndexedSubscript:)];
+        
+        
+        //removeObjectAtIndex:
+        [AvoidCrash exchangeInstanceMethod:arrayMClass method1Sel:@selector(removeObjectAtIndex:) method2Sel:@selector(avoidCrashRemoveObjectAtIndex:)];
+        
+        //insertObject:atIndex:
+        [AvoidCrash exchangeInstanceMethod:arrayMClass method1Sel:@selector(insertObject:atIndex:) method2Sel:@selector(avoidCrashInsertObject:atIndex:)];
+        
+        //getObjects:range:
+        [AvoidCrash exchangeInstanceMethod:arrayMClass method1Sel:@selector(getObjects:range:) method2Sel:@selector(avoidCrashGetObjects:range:)];
+    });
+    
+    
+    
+}
+
+
+//=================================================================
+//                    array set object at index
+//=================================================================
+#pragma mark - get object from array
+
+
+- (void)avoidCrashSetObject:(id)obj atIndexedSubscript:(NSUInteger)idx {
+    
+    @try {
+        [self avoidCrashSetObject:obj atIndexedSubscript:idx];
+    }
+    @catch (NSException *exception) {
+        [AvoidCrash noteErrorWithException:exception defaultToDo:AvoidCrashDefaultIgnore];
+    }
+    @finally {
+        
+    }
+}
+
+
+//=================================================================
+//                    removeObjectAtIndex:
+//=================================================================
+#pragma mark - removeObjectAtIndex:
+
+- (void)avoidCrashRemoveObjectAtIndex:(NSUInteger)index {
+    @try {
+        [self avoidCrashRemoveObjectAtIndex:index];
+    }
+    @catch (NSException *exception) {
+        [AvoidCrash noteErrorWithException:exception defaultToDo:AvoidCrashDefaultIgnore];
+    }
+    @finally {
+        
+    }
+}
+
+
+//=================================================================
+//                    insertObject:atIndex:
+//=================================================================
+#pragma mark - set方法
+- (void)avoidCrashInsertObject:(id)anObject atIndex:(NSUInteger)index {
+    @try {
+        [self avoidCrashInsertObject:anObject atIndex:index];
+    }
+    @catch (NSException *exception) {
+        [AvoidCrash noteErrorWithException:exception defaultToDo:AvoidCrashDefaultIgnore];
+    }
+    @finally {
+        
+    }
+}
+
+
+//=================================================================
+//                           objectAtIndex:
+//=================================================================
+#pragma mark - objectAtIndex:
+
+- (id)avoidCrashObjectAtIndex:(NSUInteger)index {
+    id object = nil;
+    
+    @try {
+        object = [self avoidCrashObjectAtIndex:index];
+    }
+    @catch (NSException *exception) {
+        NSString *defaultToDo = AvoidCrashDefaultReturnNil;
+        [AvoidCrash noteErrorWithException:exception defaultToDo:defaultToDo];
+    }
+    @finally {
+        return object;
+    }
+}
+
+//=================================================================
+//                     objectAtIndexedSubscript:
+//=================================================================
+#pragma mark - objectAtIndexedSubscript:
+- (id)avoidCrashObjectAtIndexedSubscript:(NSUInteger)idx {
+    id object = nil;
+    
+    @try {
+        object = [self avoidCrashObjectAtIndexedSubscript:idx];
+    }
+    @catch (NSException *exception) {
+        NSString *defaultToDo = AvoidCrashDefaultReturnNil;
+        [AvoidCrash noteErrorWithException:exception defaultToDo:defaultToDo];
+    }
+    @finally {
+        return object;
+    }
+    
+}
+
+
+//=================================================================
+//                         getObjects:range:
+//=================================================================
+#pragma mark - getObjects:range:
+
+- (void)avoidCrashGetObjects:(__unsafe_unretained id  _Nonnull *)objects range:(NSRange)range {
+    
+    @try {
+        [self avoidCrashGetObjects:objects range:range];
+    } @catch (NSException *exception) {
+        
+        NSString *defaultToDo = AvoidCrashDefaultIgnore;
+        [AvoidCrash noteErrorWithException:exception defaultToDo:defaultToDo];
+        
+    } @finally {
+        
+    }
+}
+
+
+
+
+@end

+ 23 - 0
RunGame/SDK/ThirdClass/AvoidCrash/NSMutableAttributedString+AvoidCrash.h

@@ -0,0 +1,23 @@
+//
+//  NSMutableAttributedString+AvoidCrash.h
+//  https://github.com/chenfanfang/AvoidCrash
+//
+//  Created by mac on 16/10/15.
+//  Copyright © 2016年 chenfanfang. All rights reserved.
+//
+
+#import <Foundation/Foundation.h>
+#import "AvoidCrashProtocol.h"
+
+@interface NSMutableAttributedString (AvoidCrash)<AvoidCrashProtocol>
+
+
+@end
+
+
+/**
+ *  Can avoid crash method
+ *
+ *  1.- (instancetype)initWithString:(NSString *)str
+ *  2.- (instancetype)initWithString:(NSString *)str attributes:(NSDictionary<NSString *,id> *)attrs
+ */

+ 74 - 0
RunGame/SDK/ThirdClass/AvoidCrash/NSMutableAttributedString+AvoidCrash.m

@@ -0,0 +1,74 @@
+//
+//  NSMutableAttributedString+AvoidCrash.m
+//  https://github.com/chenfanfang/AvoidCrash
+//
+//  Created by mac on 16/10/15.
+//  Copyright © 2016年 chenfanfang. All rights reserved.
+//
+
+#import "NSMutableAttributedString+AvoidCrash.h"
+
+#import "AvoidCrash.h"
+
+@implementation NSMutableAttributedString (AvoidCrash)
+
++ (void)avoidCrashExchangeMethod {
+    
+    static dispatch_once_t onceToken;
+    dispatch_once(&onceToken, ^{
+        
+        Class NSConcreteMutableAttributedString = NSClassFromString(@"NSConcreteMutableAttributedString");
+        
+        //initWithString:
+        [AvoidCrash exchangeInstanceMethod:NSConcreteMutableAttributedString method1Sel:@selector(initWithString:) method2Sel:@selector(avoidCrashInitWithString:)];
+        
+        //initWithString:attributes:
+        [AvoidCrash exchangeInstanceMethod:NSConcreteMutableAttributedString method1Sel:@selector(initWithString:attributes:) method2Sel:@selector(avoidCrashInitWithString:attributes:)];
+    });
+}
+
+//=================================================================
+//                          initWithString:
+//=================================================================
+#pragma mark - initWithString:
+
+
+- (instancetype)avoidCrashInitWithString:(NSString *)str {
+    id object = nil;
+    
+    @try {
+        object = [self avoidCrashInitWithString:str];
+    }
+    @catch (NSException *exception) {
+        NSString *defaultToDo = AvoidCrashDefaultReturnNil;
+        [AvoidCrash noteErrorWithException:exception defaultToDo:defaultToDo];
+    }
+    @finally {
+        return object;
+    }
+}
+
+
+//=================================================================
+//                     initWithString:attributes:
+//=================================================================
+#pragma mark - initWithString:attributes:
+
+
+- (instancetype)avoidCrashInitWithString:(NSString *)str attributes:(NSDictionary<NSString *,id> *)attrs {
+    id object = nil;
+    
+    @try {
+        object = [self avoidCrashInitWithString:str attributes:attrs];
+    }
+    @catch (NSException *exception) {
+        NSString *defaultToDo = AvoidCrashDefaultReturnNil;
+        [AvoidCrash noteErrorWithException:exception defaultToDo:defaultToDo];
+    }
+    @finally {
+        return object;
+    }
+}
+
+
+@end

+ 24 - 0
RunGame/SDK/ThirdClass/AvoidCrash/NSMutableDictionary+AvoidCrash.h

@@ -0,0 +1,24 @@
+//
+//  NSMutableDictionary+AvoidCrash.h
+//  https://github.com/chenfanfang/AvoidCrash
+//
+//  Created by mac on 16/9/22.
+//  Copyright © 2016年 chenfanfang. All rights reserved.
+//
+
+#import <Foundation/Foundation.h>
+#import "AvoidCrashProtocol.h"
+
+@interface NSMutableDictionary (AvoidCrash)<AvoidCrashProtocol>
+
+
+@end
+
+
+/**
+ *  Can avoid crash method
+ *
+ *  1. - (void)setObject:(id)anObject forKey:(id<NSCopying>)aKey
+ *  2. - (void)removeObjectForKey:(id)aKey
+ *
+ */

+ 95 - 0
RunGame/SDK/ThirdClass/AvoidCrash/NSMutableDictionary+AvoidCrash.m

@@ -0,0 +1,95 @@
+//
+//  NSMutableDictionary+AvoidCrash.m
+//  https://github.com/chenfanfang/AvoidCrash
+//
+//  Created by mac on 16/9/22.
+//  Copyright © 2016年 chenfanfang. All rights reserved.
+//
+
+#import "NSMutableDictionary+AvoidCrash.h"
+
+#import "AvoidCrash.h"
+
+@implementation NSMutableDictionary (AvoidCrash)
+
++ (void)avoidCrashExchangeMethod {
+    
+    static dispatch_once_t onceToken;
+    dispatch_once(&onceToken, ^{
+        Class dictionaryM = NSClassFromString(@"__NSDictionaryM");
+        
+        //setObject:forKey:
+        [AvoidCrash exchangeInstanceMethod:dictionaryM method1Sel:@selector(setObject:forKey:) method2Sel:@selector(avoidCrashSetObject:forKey:)];
+        
+        //setObject:forKeyedSubscript:
+        if (AvoidCrashIsiOS(11.0)) {
+            [AvoidCrash exchangeInstanceMethod:dictionaryM method1Sel:@selector(setObject:forKeyedSubscript:) method2Sel:@selector(avoidCrashSetObject:forKeyedSubscript:)];
+        }
+        
+        
+        
+        //removeObjectForKey:
+        Method removeObjectForKey = class_getInstanceMethod(dictionaryM, @selector(removeObjectForKey:));
+        Method avoidCrashRemoveObjectForKey = class_getInstanceMethod(dictionaryM, @selector(avoidCrashRemoveObjectForKey:));
+        method_exchangeImplementations(removeObjectForKey, avoidCrashRemoveObjectForKey);
+    });
+}
+
+
+//=================================================================
+//                       setObject:forKey:
+//=================================================================
+#pragma mark - setObject:forKey:
+
+- (void)avoidCrashSetObject:(id)anObject forKey:(id<NSCopying>)aKey {
+    
+    @try {
+        [self avoidCrashSetObject:anObject forKey:aKey];
+    }
+    @catch (NSException *exception) {
+        [AvoidCrash noteErrorWithException:exception defaultToDo:AvoidCrashDefaultIgnore];
+    }
+    @finally {
+        
+    }
+}
+
+//=================================================================
+//                  setObject:forKeyedSubscript:
+//=================================================================
+#pragma mark - setObject:forKeyedSubscript:
+- (void)avoidCrashSetObject:(id)obj forKeyedSubscript:(id<NSCopying>)key {
+    @try {
+        [self avoidCrashSetObject:obj forKeyedSubscript:key];
+    }
+    @catch (NSException *exception) {
+        [AvoidCrash noteErrorWithException:exception defaultToDo:AvoidCrashDefaultIgnore];
+    }
+    @finally {
+        
+    }
+}
+
+
+//=================================================================
+//                       removeObjectForKey:
+//=================================================================
+#pragma mark - removeObjectForKey:
+
+- (void)avoidCrashRemoveObjectForKey:(id)aKey {
+    
+    @try {
+        [self avoidCrashRemoveObjectForKey:aKey];
+    }
+    @catch (NSException *exception) {
+        [AvoidCrash noteErrorWithException:exception defaultToDo:AvoidCrashDefaultIgnore];
+    }
+    @finally {
+        
+    }
+}
+
+
+
+
+@end

+ 29 - 0
RunGame/SDK/ThirdClass/AvoidCrash/NSMutableString+AvoidCrash.h

@@ -0,0 +1,29 @@
+//
+//  NSMutableString+AvoidCrash.h
+//  https://github.com/chenfanfang/AvoidCrash
+//
+//  Created by mac on 16/10/6.
+//  Copyright © 2016年 chenfanfang. All rights reserved.
+//
+
+#import <Foundation/Foundation.h>
+#import "AvoidCrashProtocol.h"
+
+@interface NSMutableString (AvoidCrash)<AvoidCrashProtocol>
+
+
+@end
+
+
+/**
+ *  Can avoid crash method
+ *
+ *  1. 由于NSMutableString是继承于NSString,所以这里和NSString有些同样的方法就不重复写了
+ *  2. - (void)replaceCharactersInRange:(NSRange)range withString:(NSString *)aString
+ *  3. - (void)insertString:(NSString *)aString atIndex:(NSUInteger)loc
+ *  4. - (void)deleteCharactersInRange:(NSRange)range
+ *
+ */
+
+
+

+ 97 - 0
RunGame/SDK/ThirdClass/AvoidCrash/NSMutableString+AvoidCrash.m

@@ -0,0 +1,97 @@
+//
+//  NSMutableString+AvoidCrash.m
+//  https://github.com/chenfanfang/AvoidCrash
+//
+//  Created by mac on 16/10/6.
+//  Copyright © 2016年 chenfanfang. All rights reserved.
+//
+
+#import "NSMutableString+AvoidCrash.h"
+
+#import "AvoidCrash.h"
+
+@implementation NSMutableString (AvoidCrash)
+
++ (void)avoidCrashExchangeMethod {
+    
+    static dispatch_once_t onceToken;
+    dispatch_once(&onceToken, ^{
+        
+        Class stringClass = NSClassFromString(@"__NSCFString");
+        
+        //replaceCharactersInRange
+        [AvoidCrash exchangeInstanceMethod:stringClass method1Sel:@selector(replaceCharactersInRange:withString:) method2Sel:@selector(avoidCrashReplaceCharactersInRange:withString:)];
+        
+        //insertString:atIndex:
+        [AvoidCrash exchangeInstanceMethod:stringClass method1Sel:@selector(insertString:atIndex:) method2Sel:@selector(avoidCrashInsertString:atIndex:)];
+        
+        //deleteCharactersInRange
+        [AvoidCrash exchangeInstanceMethod:stringClass method1Sel:@selector(deleteCharactersInRange:) method2Sel:@selector(avoidCrashDeleteCharactersInRange:)];
+    });
+}
+
+//=================================================================
+//                     replaceCharactersInRange
+//=================================================================
+#pragma mark - replaceCharactersInRange
+
+- (void)avoidCrashReplaceCharactersInRange:(NSRange)range withString:(NSString *)aString {
+    
+    @try {
+        [self avoidCrashReplaceCharactersInRange:range withString:aString];
+    }
+    @catch (NSException *exception) {
+        NSString *defaultToDo = AvoidCrashDefaultIgnore;
+        [AvoidCrash noteErrorWithException:exception defaultToDo:defaultToDo];
+    }
+    @finally {
+        
+    }
+}
+
+//=================================================================
+//                     insertString:atIndex:
+//=================================================================
+#pragma mark - insertString:atIndex:
+
+- (void)avoidCrashInsertString:(NSString *)aString atIndex:(NSUInteger)loc {
+    
+    @try {
+        [self avoidCrashInsertString:aString atIndex:loc];
+    }
+    @catch (NSException *exception) {
+        NSString *defaultToDo = AvoidCrashDefaultIgnore;
+        [AvoidCrash noteErrorWithException:exception defaultToDo:defaultToDo];
+    }
+    @finally {
+        
+    }
+}
+
+//=================================================================
+//                   deleteCharactersInRange
+//=================================================================
+#pragma mark - deleteCharactersInRange
+
+- (void)avoidCrashDeleteCharactersInRange:(NSRange)range {
+    
+    @try {
+        [self avoidCrashDeleteCharactersInRange:range];
+    }
+    @catch (NSException *exception) {
+        NSString *defaultToDo = AvoidCrashDefaultIgnore;
+        [AvoidCrash noteErrorWithException:exception defaultToDo:defaultToDo];
+    }
+    @finally {
+        
+    }
+}
+
+
+
+
+
+
+
+
+@end

+ 34 - 0
RunGame/SDK/ThirdClass/AvoidCrash/NSObject+AvoidCrash.h

@@ -0,0 +1,34 @@
+//
+//  NSObject+AvoidCrash.h
+//  https://github.com/chenfanfang/AvoidCrash
+//
+//  Created by mac on 16/10/11.
+//  Copyright © 2016年 chenfanfang. All rights reserved.
+//
+
+#import <Foundation/Foundation.h>
+
+
+@interface NSObject (AvoidCrash)
+
+/** 
+ *  ifDealWithNoneSel : 是否开启"unrecognized selector sent to instance"异常的捕获
+ */
++ (void)avoidCrashExchangeMethodIfDealWithNoneSel:(BOOL)ifDealWithNoneSel;
+
+
++ (void)setupNoneSelClassStringsArr:(NSArray<NSString *> *)classStrings;
+
++ (void)setupNoneSelClassStringPrefixsArr:(NSArray<NSString *> *)classStringPrefixs;
+
+@end
+
+/**
+ *  Can avoid crash method
+ *
+ *  1.- (void)setValue:(id)value forKey:(NSString *)key
+ *  2.- (void)setValue:(id)value forKeyPath:(NSString *)keyPath
+ *  3.- (void)setValue:(id)value forUndefinedKey:(NSString *)key //这个方法一般用来重写,不会主动调用
+ *  4.- (void)setValuesForKeysWithDictionary:(NSDictionary<NSString *,id> *)keyedValues
+ *  5. unrecognized selector sent to instance
+ */

+ 220 - 0
RunGame/SDK/ThirdClass/AvoidCrash/NSObject+AvoidCrash.m

@@ -0,0 +1,220 @@
+//
+//  NSObject+AvoidCrash.m
+//  https://github.com/chenfanfang/AvoidCrash
+//
+//  Created by mac on 16/10/11.
+//  Copyright © 2016年 chenfanfang. All rights reserved.
+//
+
+#import "NSObject+AvoidCrash.h"
+#import "AvoidCrash.h"
+#import "AvoidCrashStubProxy.h"
+
+@implementation NSObject (AvoidCrash)
+
+
++ (void)avoidCrashExchangeMethodIfDealWithNoneSel:(BOOL)ifDealWithNoneSel {
+    
+    static dispatch_once_t onceToken;
+    dispatch_once(&onceToken, ^{
+        //setValue:forKey:
+        [AvoidCrash exchangeInstanceMethod:[self class] method1Sel:@selector(setValue:forKey:) method2Sel:@selector(avoidCrashSetValue:forKey:)];
+        
+        //setValue:forKeyPath:
+        [AvoidCrash exchangeInstanceMethod:[self class] method1Sel:@selector(setValue:forKeyPath:) method2Sel:@selector(avoidCrashSetValue:forKeyPath:)];
+        
+        //setValue:forUndefinedKey:
+        [AvoidCrash exchangeInstanceMethod:[self class] method1Sel:@selector(setValue:forUndefinedKey:) method2Sel:@selector(avoidCrashSetValue:forUndefinedKey:)];
+        
+        //setValuesForKeysWithDictionary:
+        [AvoidCrash exchangeInstanceMethod:[self class] method1Sel:@selector(setValuesForKeysWithDictionary:) method2Sel:@selector(avoidCrashSetValuesForKeysWithDictionary:)];
+        
+        
+        //unrecognized selector sent to instance
+        if (ifDealWithNoneSel) {
+            [AvoidCrash exchangeInstanceMethod:[self class] method1Sel:@selector(methodSignatureForSelector:) method2Sel:@selector(avoidCrashMethodSignatureForSelector:)];
+            [AvoidCrash exchangeInstanceMethod:[self class] method1Sel:@selector(forwardInvocation:) method2Sel:@selector(avoidCrashForwardInvocation:)];
+        }
+    });
+}
+
+
+//=================================================================
+//              unrecognized selector sent to instance
+//=================================================================
+#pragma mark - unrecognized selector sent to instance
+
+
+static NSMutableArray *noneSelClassStrings;
+static NSMutableArray *noneSelClassStringPrefixs;
+
++ (void)setupNoneSelClassStringsArr:(NSArray<NSString *> *)classStrings {
+    
+    if (noneSelClassStrings){
+        NSString *warningMsg = [NSString stringWithFormat:@"\n\n%@\n\n[AvoidCrash setupNoneSelClassStringsArr:];\n调用一此即可,多次调用会自动忽略后面的调用\n\n%@\n\n",AvoidCrashSeparatorWithFlag,AvoidCrashSeparator];
+        AvoidCrashLog(@"%@",warningMsg);
+    }
+    
+    static dispatch_once_t onceToken;
+    dispatch_once(&onceToken, ^{
+        noneSelClassStrings = [NSMutableArray array];
+        for (NSString *className in classStrings) {
+            if ([className hasPrefix:@"UI"] == NO &&
+                [className isEqualToString:NSStringFromClass([NSObject class])] == NO) {
+                [noneSelClassStrings addObject:className];
+            } else {
+                NSString *warningMsg = [NSString stringWithFormat:@"\n\n%@\n\n[AvoidCrash setupNoneSelClassStringsArr:];\n会忽略UI开头的类和NSObject类(请使用NSObject的子类)\n\n%@\n\n",AvoidCrashSeparatorWithFlag,AvoidCrashSeparator];
+                AvoidCrashLog(@"%@",warningMsg);
+            }
+        }
+    });
+    
+}
+
+/**
+ *  初始化一个需要防止”unrecognized selector sent to instance”的崩溃的类名前缀的数组
+ */
++ (void)setupNoneSelClassStringPrefixsArr:(NSArray<NSString *> *)classStringPrefixs {
+    if (noneSelClassStringPrefixs) {
+        
+        NSString *warningMsg = [NSString stringWithFormat:@"\n\n%@\n\n[AvoidCrash setupNoneSelClassStringPrefixsArr:];\n调用一此即可,多次调用会自动忽略后面的调用\n\n%@\n\n",AvoidCrashSeparatorWithFlag,AvoidCrashSeparator];
+        AvoidCrashLog(@"%@",warningMsg);
+    }
+    
+    static dispatch_once_t onceToken;
+    dispatch_once(&onceToken, ^{
+        
+        noneSelClassStringPrefixs = [NSMutableArray array];
+        for (NSString *classNamePrefix in classStringPrefixs) {
+            if ([classNamePrefix hasPrefix:@"UI"] == NO &&
+                [classNamePrefix hasPrefix:@"NS"] == NO) {
+                [noneSelClassStringPrefixs addObject:classNamePrefix];
+                
+            } else {
+                NSString *warningMsg = [NSString stringWithFormat:@"\n\n%@\n\n[AvoidCrash setupNoneSelClassStringsArr:];\n会忽略UI开头的类和NS开头的类\n若需要对NS开头的类防止”unrecognized selector sent to instance”(比如NSArray),请使用setupNoneSelClassStringsArr:\n\n%@\n\n",AvoidCrashSeparatorWithFlag,AvoidCrashSeparator];
+                AvoidCrashLog(@"%@",warningMsg);
+            }
+        }
+    });
+}
+
+- (NSMethodSignature *)avoidCrashMethodSignatureForSelector:(SEL)aSelector {
+    
+    NSMethodSignature *ms = [self avoidCrashMethodSignatureForSelector:aSelector];
+    
+    BOOL flag = NO;
+    if (ms == nil) {
+        for (NSString *classStr in noneSelClassStrings) {
+            if ([self isKindOfClass:NSClassFromString(classStr)]) {
+                ms = [AvoidCrashStubProxy instanceMethodSignatureForSelector:@selector(proxyMethod)];
+                flag = YES;
+                break;
+            }
+        }
+    }
+    if (flag == NO) {
+        NSString *selfClass = NSStringFromClass([self class]);
+        for (NSString *classStrPrefix in noneSelClassStringPrefixs) {
+            if ([selfClass hasPrefix:classStrPrefix]) {
+                ms = [AvoidCrashStubProxy instanceMethodSignatureForSelector:@selector(proxyMethod)];
+            }
+        }
+    }
+    return ms;
+}
+
+- (void)avoidCrashForwardInvocation:(NSInvocation *)anInvocation {
+    
+    @try {
+        [self avoidCrashForwardInvocation:anInvocation];
+        
+    } @catch (NSException *exception) {
+        NSString *defaultToDo = AvoidCrashDefaultIgnore;
+        [AvoidCrash noteErrorWithException:exception defaultToDo:defaultToDo];
+        
+    } @finally {
+        
+    }
+    
+}
+
+
+//=================================================================
+//                         setValue:forKey:
+//=================================================================
+#pragma mark - setValue:forKey:
+
+- (void)avoidCrashSetValue:(id)value forKey:(NSString *)key {
+    @try {
+        [self avoidCrashSetValue:value forKey:key];
+    }
+    @catch (NSException *exception) {
+        NSString *defaultToDo = AvoidCrashDefaultIgnore;
+        [AvoidCrash noteErrorWithException:exception defaultToDo:defaultToDo];
+    }
+    @finally {
+        
+    }
+}
+
+
+//=================================================================
+//                     setValue:forKeyPath:
+//=================================================================
+#pragma mark - setValue:forKeyPath:
+
+- (void)avoidCrashSetValue:(id)value forKeyPath:(NSString *)keyPath {
+    @try {
+        [self avoidCrashSetValue:value forKeyPath:keyPath];
+    }
+    @catch (NSException *exception) {
+        NSString *defaultToDo = AvoidCrashDefaultIgnore;
+        [AvoidCrash noteErrorWithException:exception defaultToDo:defaultToDo];
+    }
+    @finally {
+        
+    }
+}
+
+
+
+//=================================================================
+//                     setValue:forUndefinedKey:
+//=================================================================
+#pragma mark - setValue:forUndefinedKey:
+
+- (void)avoidCrashSetValue:(id)value forUndefinedKey:(NSString *)key {
+    @try {
+        [self avoidCrashSetValue:value forUndefinedKey:key];
+    }
+    @catch (NSException *exception) {
+        NSString *defaultToDo = AvoidCrashDefaultIgnore;
+        [AvoidCrash noteErrorWithException:exception defaultToDo:defaultToDo];
+    }
+    @finally {
+        
+    }
+}
+
+
+//=================================================================
+//                  setValuesForKeysWithDictionary:
+//=================================================================
+#pragma mark - setValuesForKeysWithDictionary:
+
+- (void)avoidCrashSetValuesForKeysWithDictionary:(NSDictionary<NSString *,id> *)keyedValues {
+    @try {
+        [self avoidCrashSetValuesForKeysWithDictionary:keyedValues];
+    }
+    @catch (NSException *exception) {
+        NSString *defaultToDo = AvoidCrashDefaultIgnore;
+        [AvoidCrash noteErrorWithException:exception defaultToDo:defaultToDo];
+    }
+    @finally {
+        
+    }
+}
+
+
+
+@end

Some files were not shown because too many files changed in this diff