cbcentralmanager

CBPeripheral.ancsAuthorized info is unreliable

烂漫一生 提交于 2020-05-13 14:31:51
问题 Our app works with a paired Bluetooth peripheral that uses ANCS, that is why I dug early into the brand new privacy setting "Share System Notifications" to make our app ready for iOS13... However there is an issue, the CBPeripheral property ancsAuthorized(Bool) is unreliable, so then it is impossible to know if the user granted the authorization or not. It is unreliable in 2 ways: Once connected to the peripheral, asking peripheral.ancsAuthorized returns always false at first, then after some

Why do all devices discovered by CBCentralmanager have name=null?

拈花ヽ惹草 提交于 2020-03-26 05:19:40
问题 I am attempting to detect battery levels for connected BT devices on macOS. While I can get CBCentralManager to detect SOME nearby devices, all of the devices it detects are name=Null, even though there are numerous devices that should be detected and should have names (e.g., AirPods, magic trackpad, magic keyboard, etc). My BT Manager class is: import Cocoa import CoreBluetooth class BluetoothManager: NSObject, CBCentralManagerDelegate, CBPeripheralDelegate { var centralManager =

Why do all devices discovered by CBCentralmanager have name=null?

℡╲_俬逩灬. 提交于 2020-03-26 05:19:27
问题 I am attempting to detect battery levels for connected BT devices on macOS. While I can get CBCentralManager to detect SOME nearby devices, all of the devices it detects are name=Null, even though there are numerous devices that should be detected and should have names (e.g., AirPods, magic trackpad, magic keyboard, etc). My BT Manager class is: import Cocoa import CoreBluetooth class BluetoothManager: NSObject, CBCentralManagerDelegate, CBPeripheralDelegate { var centralManager =

init CBCentralManager: Type of expression is ambiguous without more context

我与影子孤独终老i 提交于 2020-01-24 14:37:26
问题 Trying to initialize a CBCentralManager in a Swift 4.2 project. Get the error shown in comment: import CoreBluetooth class SomeClass: NSObject, CBCentralManagerDelegate { // Type of expression is ambiguous without more context let manager: CBCentralManager = CBCentralManager(delegate: self, queue: nil) // MARK: - Functions: CBCentralManagerDelegate func centralManagerDidUpdateState(_ central: CBCentralManager) { } } If I switch self out for nil the error goes away, so I think I'm missing

BLE send passkey programmatically [closed]

社会主义新天地 提交于 2020-01-14 05:51:10
问题 Closed . This question needs to be more focused. It is not currently accepting answers. Want to improve this question? Update the question so it focuses on one problem only by editing this post. Closed 5 years ago . When i connect my device to my peripheral, he asks me a passkey (a pop-up is shown on the device). I want to send this passkey programmatically during the connection. I'm using CBCentralManager but I can't find a way to send it. Any suggestions? 回答1: You can't do this. This is

iOS stops waking up the app upon incoming BLE connection from peripheral

流过昼夜 提交于 2020-01-13 18:33:11
问题 we have a BLE peripheral that connects to the phone every hour and passes some data. Here is how the process works: Upon launch with key UIApplicationLaunchOptionsBluetoothCentralsKey in application(didFinishLaunchingWithOptions launchOptions) app re-initializes CBCentralManager with ID that was passed to it. Then it goes through the regular restoration cycle and reads data off the BLE peripheral. Performs REST request to the service in the cloud. Assuming that app has been launched at least

How do you scan for the same BLE device twice?

最后都变了- 提交于 2020-01-06 03:07:20
问题 I have an iOS app that scans for BLE peripherals, of which there may be many, and allows the user to decide whether or not to connect to the device. Once connected, the user can also decide to break the connection. All of this works fine. I would also like to add an option to allow the user to change their mind and rescan for a device, but this seems to be problematic. The most obvious way to do this seems to be to stop scanning and restart it, as in: [centralManager stopScan]; CBUUID

iOs CoreBluetooth Central Server and Peripheral Client

天涯浪子 提交于 2020-01-05 19:29:30
问题 Currently, iOS does not support the combination GAP Central role and ATT Server role as well as the combination GAP Peripheral role and ATT Client role. Is Apple working on this? Does someone know when it will be possible to do so ? 回答1: If you develop a non iOS peripheral, then you should be able to start acting as ATT client once the iOS central connected to you. The ATT database is shared accross applications and should be accessible this way. You can initialize it in a separate app or in

CoreBluetooth state preservation: correct way to restore CBCentralManager

浪子不回头ぞ 提交于 2020-01-04 17:16:31
问题 what is the correct way to restore the CBCentralManager from AppDelegate when the App gets lunched with options due to a state preservation event? - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { // The system provides the restoration identifiers only for central managers that had active or pending peripheral connections or were scanning for peripherals. NSArray * centralManagerIdentifiers = launchOptions

CoreBluetooth state preservation: correct way to restore CBCentralManager

好久不见. 提交于 2020-01-04 17:15:10
问题 what is the correct way to restore the CBCentralManager from AppDelegate when the App gets lunched with options due to a state preservation event? - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { // The system provides the restoration identifiers only for central managers that had active or pending peripheral connections or were scanning for peripherals. NSArray * centralManagerIdentifiers = launchOptions