![](/img/trans.png)
[英]IOS vs OSX BLE: Instantiating CBCentralManager - coding for iOS
[英]iOS 8 and ble CBCentralManager not working
我有一個iOS應用程序,它使用ble連接到設備。 iOS 7正在運行。 升級到iOS 8后,CBCentralManager找不到任何外圍設備。
case CBCentralManagerStatePoweredOn:
{
NSDictionary *options = [NSDictionary dictionaryWithObjectsAndKeys:[NSNumber numberWithBool:FALSE], CBCentralManagerScanOptionAllowDuplicatesKey, nil];
//NSArray *services = [NSMutableArray new];
NSArray *services = @[[CBUUID UUIDWithString:@"0000FBB0-494C-4F47-4943-544543480000"], [CBUUID UUIDWithString:@"180A"]];
[centralManager scanForPeripheralsWithServices:services options:options];
break;
}
嘗試移動以下代碼:
NSDictionary *options = [NSDictionary dictionaryWithObjectsAndKeys:[NSNumber numberWithBool:FALSE], CBCentralManagerScanOptionAllowDuplicatesKey, nil];
//NSArray *services = [NSMutableArray new];
NSArray *services = @[[CBUUID UUIDWithString:@"0000FBB0-494C-4F47-4943-544543480000"], [CBUUID UUIDWithString:@"180A"]];
[centralManager scanForPeripheralsWithServices:services options:options];
進入Iba操作,然后在CBCentralManagerStatePoweredOn上調用該操作
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.