Thanks for being a part of WWDC25!

How did we do? We’d love to know your thoughts on this year’s conference. Take the survey here

IOBluetooth

RSS for tag

Gain user-space access to Bluetooth devices using IOBluetooth.

Posts under IOBluetooth tag

40 Posts
Sort by:

Post

Replies

Boosts

Views

Activity

How can I get a cover-art image via Bluetooth BIP
I want to get Cover-Art Image over Bluetooth. From the SDP Discover iPhoneSE, it support Cover-Art Feature. I connect and config OBEX Channel with L2CAP ERTM, it is successful. I send connect_request the OBEX Connect, the iPhone always no any response, and l2cap s-frame response from iPhone always failed. From the Apple Developer, it need Apple Authentication Chip. Is it still necessary now? Are there any other ways to obtain album pictures?
0
0
32
2w
IOBluetoothHandsFreeDevice API confusion
I wonder how one would use IOBluetoothHandsFree APIs to interact from macOS app with a bluetooth device that implements bluetooth hands free profile. My current observation is as follows: IOBluetoothDevice object representing the device correctly identifies it as a hands free device, i.e.: there is a proper record in services array, that matches the kBluetoothSDPUUID16ServiceClassHandsFree uuid, the IOBluetoothDevice handsFreeDevice property returns 1 Attempt to create IOBluetoothHandsFreeDevice using IOBluetoothDevice as described above (i.e. [[IOBluetoothHandsFreeDevice alloc] initWithDevice: myIOBluetoothDeviceThatHasHandsFreeDevicePropertySetTo1 delegate: self]) results in the following output in debugger console: SRS-XB20 is not a hands free device but trying anyways. Subsequent call to connect on an object constructed as above results in the following stream of messages: API MISUSE: <CBClassicPeer: 0x1442447b0 6D801974-5457-9ECE-0A9B-8343EC4F60AA, SRS-XB20, connected, Paired, b8:d5:0b:03:62:70, devType: 19, PID: 0x1582, VID: 0x0039> Invalid RFCOMM CID -[IOBluetoothRFCOMMChannel setupRFCOMMChannelForDevice] No channel <IOBluetoothRFCOMMChannel: 0x600003e5de00 SRS-XB20, b8-d5-0b-03-62-70, CID: 0, UUID: 110F > AddInstanceForFactory: No factory registered for id <CFUUID 0x600000b5e3e0> F8BB1C28-BAE8-11D6-9C31-00039315CD46 -[IOBluetoothRFCOMMChannel setupRFCOMMChannelForDevice] No channel <IOBluetoothRFCOMMChannel: 0x600003e5de00 SRS-XB20, b8-d5-0b-03-62-70, CID: 0, UUID: 110F > API MISUSE: <CBClassicPeer: 0x1442447b0 6D801974-5457-9ECE-0A9B-8343EC4F60AA, SRS-XB20, connected, Paired, b8:d5:0b:03:62:70, devType: 19, PID: 0x1582, VID: 0x0039> Invalid RFCOMM CID Note that this device's handsFreeServiceRecord looks as follows: ServiceName: Hands-free unit RFCOMM ChannelID: 1 Attributes: { 0 = "uint32(65539)"; 256 = "string(Hands-free unit)"; 9 = "{ { uuid32(00 00 11 1e), uint32(262) } }"; 785 = "uint32(63)"; 1 = "uuid32(00 00 11 1e)"; 6 = "{ uint32(25966), uint32(106), uint32(256) }"; 4 = "{ { uuid32(00 00 01 00) }, { uuid32(00 00 00 03), uint32(1) } }"; } and explicit attempt to open RFCOMM channel no 1 ends like this: WARNING: Unknown error: 911 Failed to open RFCOMM channel -[IOBluetoothRFCOMMChannel setupRFCOMMChannelForDevice] No channel <IOBluetoothRFCOMMChannel: 0x6000002036c0 SRS-XB20, b8-d5-0b-03-62-70, CID: 1, UUID: 111E > AddInstanceForFactory: No factory registered for id <CFUUID 0x600003719260> F8BB1C28-BAE8-11D6-9C31-00039315CD46 -[IOBluetoothRFCOMMChannel waitforChanneOpen] CID:1 - timed out waiting to open -[IOBluetoothDevice openRFCOMMChannelSync:withChannelID:delegate:] CID:1 error -536870212 call returned: -536870212
0
0
65
2w
`sdpQueryComplete:status:` not being called
I try to refresh the SDP data for a Bluetooth device that has reconnected. So when I receive connect notification I call -[IOBluetoothDevice performSDPQuery:] passing object, that should receive the query completion call. What I observe is that sdpQueryComplete:status: is not being called, buit calling performSDPQuery causes additional connect notification to be dispatched. Running this under debugger results in some weird log line: [IOBluetooth] **** This currently won't trigger SDP delegate I run this code on Sequoia 15.5
2
0
39
3w
How can I prevent virtual location from affecting the security of my app
Hello, I have noticed that some users have modified their real location through an app called "MGU" to bypass my app's security checks. I want to know how to protect my app and detect users using virtual location. I have reproduced the process of virtual positioning here: Insert a plug-in through the interface at the bottom of the phone and connect it via Bluetooth on the phone Set the desired positioning target on the "MGU" app Turn off your phone's WiFi, network, and location for 10 seconds, then turn it back on At this point, virtual positioning is successful. Please assist me in troubleshooting this issue and inform me of the principle of implementing virtual positioning in this app and how to prevent it. The following is the screen recording of virtual positioning operation: https://flowus.cn/share/145b3232-26c3-4ea3-b3ff-4aad1495eb4d
1
0
54
Apr ’25
NSLocalizedDescription = \"Peer removed pairing information\";
After hardware and mobile phone hid mode pairing, the first connection is successful, after a while disconnect and reconnect,APP monitoring Bluetooth error NSLocalizedDescription = "Peer removed pairing information"; Failed to connect Hardware engineers detect the pairing information and find that the local pairing information of the iPhone has changed, which is a non-mandatory phenomenon
1
0
21
Apr ’25
BLE timeout issue when connecting two devices on iOS 18 (but not iOS 16)
Hi, We’re developing a BLE peripheral device and encountered a connection issue when connecting two devices (Device A and Device B) simultaneously to an iOS device. Problem: On iOS 18, we are experiencing occasional BLE timeouts and disconnections when both devices are connected at the same time. On iOS 16, we did not encounter this issue under the same conditions. What we’ve tried: Adjusted the connection interval from 30ms to 15ms. This seems to have improved stability somewhat. However, we still observe intermittent timeout/disconnection issues. Questions: Are there any known changes in BLE connection handling or timing constraints in iOS 18? Are there recommended connection parameter settings (interval, latency, timeout, etc.) for multi-device BLE connections in iOS? Is there a way to debug or log more details about the disconnection reasons on the iOS side? Any guidance or suggestions would be greatly appreciated.
0
0
52
Apr ’25
Bluetooth
你好,有个问题想请教一下: 我们的app是一款与CGM实时血糖相关的app,app支持在后台通过蓝牙跟CGM血糖设备保持连接。 现在遇到一个问题: 首先,app在后台运行期间,蓝牙是开启状态的,跟CGM设备也是连接的状态。 某个时刻,监听到蓝牙的状态突然从 poweredOn 变为了 resetting ,然后蓝牙又恢复了,状态变为了 poweredOn 这时候,问题出现了:之前连接的那个CGM血糖设备一直无法扫描到了!! 我想问一下: 什么情况下,蓝牙状态会变为resetting 蓝牙状态恢复为poweredOn后,之前连接的那个CGM血糖设备一直无法扫描到了,为什么?我要怎么做才能恢复,重新扫描到之前连接的这个设备?
1
0
41
Mar ’25
CarPlay shows black screen on my car for first connection if iOS version larger than 17.5
iPhone: iPhone 12 pro max, iOS:18.3.1 Step: Connect CarPlay to my car, after connection success, CarPlay screen is black. This issue only happens of first time connection; I have asked OEM factory, they told me because of my iOS version is larger than 17.5, and above this version, will have this issue. So, I need your help to figure problem and update in new version.
0
0
257
Mar ’25
PHPickerViewController No Auto Focus
The issue is, I cannot auto acquire bluetooth keyboard focus in PHPickerViewController after enabling 'Full Keyboard Access' in my IPhone 14 with iOS version 18.3.1. The keyboard focus in PHPickerViewController will show, however, after I tapped on the blank space of the PHPickerViewController. How to make the focus on at the first place then? I'm using UINavigationController and calling setNavigationBarHidden(true, animated: false). Then I use this controller to present PHPickerViewController using some configuration setup below. self.configuration = PHPickerConfiguration() configuration.filter = .any(of: filters) configuration.selectionLimit = selectionLimit if #available(iOS 15.0, *), allowOrdering { configuration.selection = .ordered } configuration.preferredAssetRepresentationMode = .current Finally I set the delegate to PHPickerViewController and call UINavigationController.present(PHPickerViewController, animated: true) to render it. Also I notice animation showing in first video then disappear.
2
0
227
Mar ’25
Playing audio live from Bluetooth headset on iPhone speaker
Hi guys, I am having issue in live-streaming audio from Bluetooth headset and playing it live on the iPhone speaker. I am able to redirect audio back to the headset but this is not what I want. The issue happens when I am trying to override output - the iPhone switches to speaker but also switches a microphone. This is example of the code: import AVFoundation class AudioRecorder { let player: AVAudioPlayerNode let engine:AVAudioEngine let audioSession:AVAudioSession let audioSessionOutput:AVAudioSession init() { self.player = AVAudioPlayerNode() self.engine = AVAudioEngine() self.audioSession = AVAudioSession.sharedInstance() self.audioSessionOutput = AVAudioSession() do { try self.audioSession.setCategory(AVAudioSession.Category.playAndRecord, options: [.defaultToSpeaker]) try self.audioSessionOutput.setCategory(AVAudioSession.Category.playAndRecord, options: [.allowBluetooth]) // enables Bluetooth HFP profile try self.audioSession.setMode(AVAudioSession.Mode.default) try self.audioSession.setActive(true) // try self.audioSession.overrideOutputAudioPort(.speaker) // doens't work } catch { print(error) } let input = self.engine.inputNode self.engine.attach(self.player) let bus = 0 let inputFormat = input.inputFormat(forBus: bus) self.engine.connect(self.player, to: engine.mainMixerNode, format: inputFormat) input.installTap(onBus: bus, bufferSize: 512, format: inputFormat) { (buffer, time) -> Void in self.player.scheduleBuffer(buffer) print(buffer) } } public func start() { try! self.engine.start() self.player.play() } public func stop() { self.player.stop() self.engine.stop() } } I am not sure if this is a bug or not. Can somebody point me into the right direction? I there a way to design a custom audio routing? I would also appreciate some good documentation besides AVFoundation docs.
0
0
246
Mar ’25
Bluetooth peripheral factory reset
Hi, I'm developing a bluetooth peripheral. During factory reset I generate a new IRK and drop any bond information it has. When I then try to bond again with the device iOS returns bonding failed with 0x08 (unspecified reason). I assume that iOS somehow still thinks my reset device is the same as the device it has already bonded with. What information about the device is it using to draw this conclusion? Bonding works if I remove the "pre-reset" peripheral from the iOS list of bluetooth devices. Regards
1
0
161
Mar ’25
Bluetooth driver crashes on IOS 18.2.1 (22C161)
I have been trying to investigate some of the kernel crashes I have noticed on my IOS crash logs. Some of these are in device driver software for the peripheral interfaces. Given that the driver code executes with kernel privileges, these kind of crashes leave the device vulnerable to remote code injection, with no user interaction required in some cases. Crash Report from IOS 18.2.1 If Apple can provide the symbol table for IOS 18.2.1 blue tooth driver and source code, I can gladly help investigate this further.
1
0
310
Feb ’25
Possible to allow x code builds to run background processes for over 3 minutes
I have an app that I'm using for my own purposes and is not in the app store. I would like to run an http server in the background for more than the allotted 3 minutes to allow persistent communications with a connected Bluetooth device. The Bluetooth device would poll the service at intervals. Is this possible to do? This app does not need app store approval since it's only for personal use.
2
0
310
Feb ’25
BLE iOS in background (app collapsed)
Hello. In my app, I need to implement the following mechanism: I need to collect data from nearby Bluetooth devices, process them, and send this information to the server at short intervals, including when the app is minimized. Is this possible on iOS? BGProcessingTask has restrictions related to battery saving policies and does not guarantee task execution at specific intervals. Additionally, there is a limitation on background task execution, which can occur no more frequently than every 15 minutes. However, some apps, such as Google Maps, work in the background and update geolocation data. Could you suggest a solution for this task? Thanks for any help on this topic
2
0
391
Jan ’25
Does BLE Peripheral work in background on iOS?
Hello, I am working on a Flutter application where I need to use Bluetooth Low Energy (BLE) in Peripheral mode to advertise data even when the app is in the background (or when the screen is turned off) on iOS devices. I am using the package flutter_ble_peripheral to handle BLE advertising and peripherals. My goal is to make sure that the BLE advertising continues running when the app is minimized or in the background. Here is what I have already done: Added the required Bluetooth permissions in Info.plist. Enabled Background Modes in Xcode (with Bluetooth LE Accessories enabled). Used the FlutterBlePeripheral.start() method to start advertising. However, when I minimize the app or turn off the screen, the BLE advertising seems to stop. I have ensured that the app is not terminated but still the advertising is not persistent. I would like to confirm whether flutter_ble_peripheral works reliably in the background on iOS, or if there are any additional configurations or limitations I need to consider to ensure that advertising continues in the background. Any insights or experiences would be greatly appreciated. Thanks!
1
0
457
Jan ’25
Unable to connect app via bluetooth in iOS
[ERROR:flutter/runtime/dart_vm_initializer.cc(41)] Unhandled Exception: PlatformException(reactive_ble_mobile.Central.(unknown context at $1013cc3b4).Failure:1, The operation couldn’t be completed. (reactive_ble_mobile.Central.(unknown context at $1013cc3b4).Failure error 1.), {}, null) #0 StandardMethodCodec.decodeEnvelope (package:flutter/src/services/message_codecs.dart:648:7) #1 MethodChannel._invokeMethod (package:flutter/src/services/platform_channel.dart:334:18) #2 ReactiveBleMobilePlatform.discoverServices. (package:reactive_ble_mobile/src/reactive_ble_mobile_platform.dart:290:15) #3 BleDeviceInteractor.discoverServices (package:ssss/pages/src/ble/ble_device_interactor.dart:47:22) #4 _DeviceInteractionTabState.discoverServices (package:ssss/pages/machines/satellite/device_interaction_tab.dart:283:20)
1
0
348
Jan ’25