萤石云 iOSSDK,移植跨平台相关工程
JLChen
2021-03-05 60bb4ce8d3ef0f8a324c6844cc990405de5d2e0f
EZSDK/EZSDK/EZ/UIViewControllers/EZAPConfigResultViewController.m
@@ -136,18 +136,33 @@
                        }
                        else
                        {
                            [EZOpenSDK addDevice:[GlobalKit shareKit].deviceSerialNo
            //                            [EZOpenSDK addDevice:[GlobalKit shareKit].deviceSerialNo
            //                                      verifyCode:[GlobalKit shareKit].deviceVerifyCode
            //                                      completion:^(NSError *error) {
            //                                          if (error)
            //                                          {
            //                                              [self addErrorProcessWithError:error];
            //                                          }
            //                                          else
            //                                          {
            //                                              [self successProcess];
            //                                          }
            //                                      }];
            [EZHttpUtil.sharedManager addDeviceByHDL:[GlobalKit shareKit].deviceSerialNo
                                      verifyCode:[GlobalKit shareKit].deviceVerifyCode
                                      completion:^(NSError *error) {
                                          if (error)
                            completion:^(ResponseData *responseData) {
                if (!responseData.success)
                                          {
                                              [self addErrorProcessWithError:error];
                    [self addErrorProcessWithError:responseData];
                                          }
                                          else
                                          {
                                              [self successProcess];
                                          }
                                      }];
                        }
                    }];
}
@@ -181,18 +196,42 @@
    [self.view makeToast:msg duration:2.0 position:@"center"];
}
- (void) addErrorProcessWithError:(NSError *) error
//- (void) addErrorProcessWithError:(NSError *) error
//{
//    NSString *msg = nil;
//    if (error.code == 120010)
//    {
//        msg = NSLocalizedString(@"device_verify_code_wrong", @"验证码错误");
//    }
//    else if (error.code == 120020)
//    {
//        msg = NSLocalizedString(@"ad_already_added", @"您已添加过此设备");
//    }
//    else if (error.code == 120022)
//    {
//        msg = NSLocalizedString(@"ad_added_by_others", @"此设备已被别人添加");
//    }
//    else
//    {
//        msg = NSLocalizedString(@"wifi_add_fail", @"添加失败");
//    }
//
//    [self.view makeToast:msg duration:2.0 position:@"center"];
//    self.msgLabel.hidden = YES;
//}
- (void) addErrorProcessWithError:(ResponseData *)responseData
{
    NSString *msg = nil;
    if (error.code == 120010)
    if ([responseData.code isEqual: @"20010"])
    {
        msg = NSLocalizedString(@"device_verify_code_wrong", @"验证码错误");
    }
    else if (error.code == 120020)
    else if ([responseData.code isEqual: @"20017"])
    {
        msg = NSLocalizedString(@"ad_already_added", @"您已添加过此设备");
    }
    else if (error.code == 120022)
    else if ([responseData.code isEqual: @"20013"])
    {
        msg = NSLocalizedString(@"ad_added_by_others", @"此设备已被别人添加");
    }