我试图通过蓝牙在iOS和OSX之间发送/接收数据。是否可以通过CoreBluetooth将iPhone4S连接到MBA?
由于GameKit不支持OSX,我需要使用其他选项。 iPhone4S和最新的Mac Book Air支持蓝牙4.0, ,所以我认为可以在这些设备之间建立连接。
但我下面的示例代码不起作用,需要你的帮助。 虽然我只是创建CBCentralManager并开始扫描设备(有两个的iPhone4S和MBA在手), - centralManager:didDiscoverPeripheral:advertisementData:RSSI:从未被称为...
- (void)start {
self.mgr = [[[CBCentralManager alloc] initWithDelegate:self queue:nil] autorelease];
NSDictionary * opts = [NSDictionary dictionaryWithObjectsAndKeys:
[NSNumber numberWithBool:YES], CBCentralManagerScanOptionAllowDuplicatesKey, nil];
[self.mgr scanForPeripheralsWithServices:nil options:opts];
}
- (void)centralManager:(CBCentralManager *)central didDiscoverPeripheral:(CBPeripheral *)peripheral advertisementData:(NSDictionary *)advertisementData RSSI:(NSNumber *)RSSI
{
// not called this delegate method...
}
这有什么错我的代码?我错过了什么吗?