如何修复'-[__ NSArrayM totalLength]:无法识别

时间:2019-01-08 01:56:14

标签: ios objective-c

我正在设置

appDele.mMediaManager=[[BluzManager alloc] initWithConnector:appDele.mBluzConnector];

和第三方库方法也已实现。当我初始化对象时,问题就出现了:

  

由于未捕获的异常'NSInvalidArgumentException'而终止应用程序,原因:'-[__ NSArrayM totalLength]:无法识别

关于_m_arrBT的NSArray出错了吗?

 -(void)connectedPeripheral:(CBPeripheral *)peripheral{

    if (m_dictConnect != nil) {

        BOOL found = NO;
        for (int i = 0; i < _m_arrBT.count; i++) {
            NSMutableDictionary *dict = [_m_arrBT objectAtIndex:i];
            CBPeripheral *device = [dict objectForKey:@"peripheral"];
            CBPeripheral *connected = [m_dictConnect objectForKey:@"peripheral"];
            //     if (device.UUID == connected.UUID) {
            if ([self isPeripheral:device equalPeripheral:connected]) {
                found = YES;
                break;
            }
        }
        if (!found) {
            [_m_arrBT addObject:m_dictConnect];
        }
        _m_arrBT = [self sortDeviceArray:_m_arrBT];
    } else {
        for (NSDictionary *dict in _m_arrBT) {
            CBPeripheral *device = [dict objectForKey:@"peripheral"];
            //    if (device.UUID == peripheral.UUID) {
            if ([self isPeripheral:device equalPeripheral:peripheral]) {
                NSLog(@"devicename=%@",[dict objectForKey:@"name"]);
            }
        }
    }

    appDele.mMediaManager=[[BluzManager alloc] initWithConnector:appDele.mBluzConnector];
    appDele.globalManager=[appDele.mMediaManager getGlobalManager:self];
    mUserDiconnected = NO;
    m_bConnect=YES;

    _m_arrBT = [self sortDeviceArray:_m_arrBT];
    [self.tableView reloadData];

    if (!mManagerReady || !mHotplugCardArrived || !mHotplugUhostArrived || !mHotplugUSBArrived) {

       // [self managerReady];
    }


}

0 个答案:

没有答案