所以,我正在为我的Mac编写一个应用程序作为中心操作并连接到我的iPhone作为外围设备。我的iPhone已准备好接收连接,我正在使用Mac应用程序。当我编写iPhone应用程序时,我发现Xcode中的模拟器无法模拟低能耗功能,所以我购买了iOS开发人员许可证,将应用程序部署到我的手机并进行测试,这解决了我的问题。
现在,使用mac应用程序,我想我可能会遇到同样的问题......但有一点不同。
- (BOOL) isLECapableHardware
{
NSString * state = nil;
switch ([manager state])
{
case CBCentralManagerStateUnsupported:
state = @"The platform/hardware doesn't support Bluetooth Low Energy.";
NSLog(@"Central manager state: %@", state);
break;
case CBCentralManagerStateUnauthorized:
state = @"The app is not authorized to use Bluetooth Low Energy.";
NSLog(@"Central manager state: %@", state);
break;
case CBCentralManagerStatePoweredOff:
state = @"Bluetooth is currently powered off.";
NSLog(@"Central manager state: %@", state);
break;
case CBCentralManagerStatePoweredOn:
return TRUE;
case CBCentralManagerStateUnknown:
default:
state = @"Bluetooth is currently powered off.";
NSLog(@"Central manager state: %@", state);
return FALSE;
}
NSLog(@"Central manager state: %@", state);
[_textField setStringValue:state];
return false;
}
当调用它时,它总是一直落到默认情况。使用iPhone应用程序,我试图用模拟器测试它时陷入状态不受支持。这是否意味着除了iOS之外我还需要购买mac开发者许可证?或者还有其他问题吗?