NSDictionary *options = @{CBCentralManagerOptionShowPowerAlertKey:@NO};
CBCentralManager *cbCentralMgr = [[CBCentralManager alloc] initWithDelegate:self queue:nil options:options];
一旦配對完之后 走的協議都不一樣 在ios9 中 走 這個方法 :
NSArray * arry = [_centralManager retrieveConnectedPeripheralsWithServices:@[[CBUUID UUIDWithString:BT_SERVICE_UUID],[CBUUID UUIDWithString:@"1802"]]];
在ios9以下的版本如下方法:
- (void)centralManager:(CBCentralManager *)central didRetrieveConnectedPeripherals:(NSArray *)peripherals
斷開連接是因為你沒有輸入密碼連接不上。。 希望能幫到樓主
參考鏈接:http://stackoverflow.com/a/4080720
iOS app首次運行時,如果使用了某些敏感功能(比如訪問相冊、發送推送等),系統會彈出一個提示框,詢問用戶是否允許。用戶一旦選擇了允許或者不允許,之后似乎就沒有后悔藥吃了,因為即使你重裝app,這個框也不會再彈出。
那正確的做法是什么呢?
1.刪除該app
2.一天之后再次安裝該app,此時又會彈出提示框了。
如果你是一個開發者,等一天絕對不是一個好策略 :( 下面的技巧在iOS 7上測試通過:
Delete your app from the device.
Turn the device off completely and turn it back on.
Go to Settings > General > Date & Time and set the date ahead a day or more.
Turn the device off completely again and turn it back on.
夠淺顯直白的,不用俺翻譯了吧 ;)