我刚刚升级到 Xcode V5.0 (5A1413) 构建成功,但是针对模拟器运行程序会导致属性定义错误:
@property (nonatomic, strong) CBCentralManager *manager; --> 线程 1:EXC_BAD_ACCESS (code=2, address=0x8)
我刚刚升级到 Xcode V5.0 (5A1413) 构建成功,但是针对模拟器运行程序会导致属性定义错误:
@property (nonatomic, strong) CBCentralManager *manager; --> 线程 1:EXC_BAD_ACCESS (code=2, address=0x8)
我遇到了同样的问题,最后求助于这个:
UIDevice *currentDevice = [UIDevice currentDevice];
if ([currentDevice.model rangeOfString:@"Simulator"].location == NSNotFound) {
self.centralMgr = [[CBCentralManager alloc] initWithDelegate:self queue:nil];
}
在模拟器上,如果我不防范 CBCentralManager 的创建,我会看到 centralManagerDidUpdateState: 使用与我的强属性匹配的 CBCentralManager* 调用。可以引用,状态为CBCentralManagerStateUnsupported。这是有道理的,但是如果那时我将我强大的管理器属性归零(因为我不会在不支持它的模拟器上执行任何 BLE),我会得到 EXC_BAD_ACCESS。因此,在没有更好的答案的情况下,我建议您根本不要解雇经理,就像我上面的代码一样。