Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

第一个XPopup中创建第二个XPopup经常出现异常 #34

Open
YXHTom opened this issue Apr 8, 2021 · 7 comments
Open

第一个XPopup中创建第二个XPopup经常出现异常 #34

YXHTom opened this issue Apr 8, 2021 · 7 comments

Comments

@YXHTom
Copy link

YXHTom commented Apr 8, 2021

我在第一个XPopup的button按钮创建并显示第二个XPopup,但是经常出现崩溃。在“LSTPopView.m“文件的511行处,代码是“id obj = popViewArr[popViewArr.count-2];”。xcode的bug提示popViewArr这个数组下标越界

@YXHTom
Copy link
Author

YXHTom commented Apr 8, 2021

我通过performSelector延迟500ms创建第二个XPopup,bug出现的概率减少但是还会出现

@LoSenTrad
Copy link
Owner

@YXHTom 代码可以展示一下吗?

@LoSenTrad
Copy link
Owner

@YXHTom 或者私聊发我源码看看

@YXHTom
Copy link
Author

YXHTom commented Apr 8, 2021

-(void)XPopup_DeviceSettingPopView{

UINib *nib = [UINib nibWithNibName:@"DeviceSettingPopView" bundle:nil];
DeviceSettingPopView *view = [nib instantiateWithOwner:nil options:nil].firstObject;
view.layer.cornerRadius = 10;
view.layer.masksToBounds = YES;
[view initValue:mapType :isJapan :isSensor];

LSTPopView *popView = [LSTPopView initWithCustomView:view popStyle:LSTPopStyleSmoothFromTop dismissStyle:LSTDismissStyleSmoothToBottom];
LSTPopViewWK(popView)
popView.bgClickBlock = ^{
    [wk_popView dismiss];
};

// popView.isHideBg = YES;
view.modeBlock = ^(int mode,int value){
NSLog(@"mode=%d",mode);

    switch (mode) {
        case 0:

// 日本手
self->isJapan=true;
[self switchControlView];
break;
case 1:
// 美国手
self->isJapan=false;
[self switchControlView];
break;
case 2:
// 重力模式 是
self->isSensor=true;
[self->_rightJS set_isGravity:self->isSensor];
break;
case 3:
// 重力模式 否
self->isSensor=false;
[self->_rightJS set_isGravity:self->isSensor];
break;
case 4:
// 地图类型 标准
self->mapType=0;
[self->_mapView setMapType:MAMapTypeStandard];
break;
case 5:
// 地图类型 卫星
self->mapType=1;
[self->_mapView setMapType:MAMapTypeSatellite];
break;
case 6:
// 地图类型 混合
self->mapType=2;

            [self->_mapView setMapType:MAMapTypeNavi];
            break;
        case 7:

// 校准地磁
self->mControlData.MagCor= 1;

            [self performSelector:@selector(delayMagCor) withObject:nil afterDelay:1];
            break;
        case 8:

// 校准加速计
self->mControlData.LevelCor= 1;

            [self performSelector:@selector(delayLevelCor) withObject:nil afterDelay:1];
            break;
        case 9:

// 离线地图
{
UIViewController *detailViewController = [MAOfflineMapViewController sharedInstance];
[self.navigationController pushViewController:detailViewController animated:YES];
self.navigationController.navigationBar.hidden = NO;
[self.navigationController setNavigationBarHidden:NO animated:YES];

        }
            break;
        case 10:

// 找回

            break;
        case 11:

// 镜头方向
[self->mWiFiTool sendTcpData:SET_VIDEO_ROLLOVERS_COMMOND_REQ withData:NULL];
break;
case 12:
// SD卡信息

// [self->mWiFiTool sendTcpData:GET_SDCARD_INFO_COMMOND_REQ withData:NULL];
[self performSelector:@selector(init_XPopup_SearchSD) withObject:nil afterDelay:0.5];

            break;
        case 13:

// 弹出SD卡
// [self XPopup_UnLockView:6];
[self->mWiFiTool sendTcpData:MOUNT_SDCARD_COMMOND_REQ withData:NULL];

            break;
        case 14:

// 设备信息
[self->mWiFiTool sendTcpData:GET_DEVICE_INFO_COMMOND_REQ withData:NULL];
break;
case 15:
// 对频信息
{

               NSString*urlString=@"http://172.16.11.10/goform/http_getusersetting";
           //    1.创建manager
               AFHTTPSessionManager *manager =[AFHTTPSessionManager manager];
           //    发送数据格式
               manager.requestSerializer=[AFHTTPRequestSerializer serializer];
           //    接受数据格式
               manager.responseSerializer=[AFJSONResponseSerializer serializerWithReadingOptions:NSJSONReadingMutableLeaves];
               manager.responseSerializer.acceptableContentTypes = [manager.responseSerializer.acceptableContentTypes setByAddingObject:@"text/html"];
               
               [manager GET:urlString parameters:nil headers:nil progress:^(NSProgress * _Nonnull downloadProgress) {
                       NSLog(@"%lli/%lli",downloadProgress.completedUnitCount,downloadProgress.totalUnitCount);
                   } success:^(NSURLSessionDataTask * _Nonnull task, id  _Nullable responseObject) {
                       NSLog(@"getApSSidInfo成功");
                      
                       
                       ApSSIDInfo* mApSSIDInfo=[ApSSIDInfo yy_modelWithJSON:responseObject];
                      
                       self->rssilimit=mApSSIDInfo.rssilimit;
                       NSLog(@"mApSSIDInfo--%d",self->rssilimit);
                       if([mApSSIDInfo.apssidgroup containsString:@"LGGO_GPS_"]){
                        
                           [self XPopup_UnLockView:8 msg:[mApSSIDInfo.apssidgroup componentsSeparatedByString:@","][0]];
                           
                       }else{
                           [self XPopup_UnLockView:9 msg:@"未配对"];
                       }
                       
                       
                   } failure:^(NSURLSessionDataTask * _Nullable task, NSError * _Nonnull error) {
                       NSLog(@"请求失败");
                       NSLog(@"error:%@",error.localizedDescription);
                   }];
           }
            break;
        
        case 16:

// 修改连接强度
self->isEditSSID = true;
[self getApSSidInfo:value];
break;

        case 17:

// 连接强度
[self getApSSidInfo:0];
break;
default:
break;
}

    [wk_popView dismiss];
};
self.popView_DeviceSettingPopView=popView;
[popView pop];

}

@YXHTom
Copy link
Author

YXHTom commented Apr 8, 2021

以上是第一个XPopup

@YXHTom
Copy link
Author

YXHTom commented Apr 8, 2021

//SD卡信息
-(void)init_XPopup_SearchSD{
if (self->mSDInfo !=nil) {
// dispatch_async(dispatch_get_main_queue(), ^{
UINib *nib = [UINib nibWithNibName:@"XPopup_SearchSD" bundle:nil];
XPopup_SearchSD *view = [nib instantiateWithOwner:nil options:nil].firstObject;

    [view setValue:self->mSDInfo.capacity :self->mSDInfo.free :self->mSDInfo.used :self->mSDInfo.type ];
    view.layer.cornerRadius = 10;
    view.layer.masksToBounds = YES;
    
    
    LSTPopView *popView = [LSTPopView initWithCustomView:view popStyle:LSTPopStyleSmoothFromTop dismissStyle:LSTDismissStyleSmoothToBottom];
    LSTPopViewWK(popView)
    popView.bgClickBlock = ^{
        [wk_popView dismiss];
    };
    self.popView_SearchSD=popView;
    [popView pop];

// });
}

@LoSenTrad
Copy link
Owner

@YXHTom 加我微信a_LSTKit 😔

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants