Search code examples
macoscore-bluetoothxpc

Do XPC errors imply failure to communicate with a macosx daemon?


I am having a problem where a mac binary that interacts with CoreBluetooth fails as CBCentralManager reports "unsupported". I have already ensured entitlements, codesigning, and Security & Privacy are set properly. When I do verbose bluetooth logging I see the following:

[com.apple.bluetooth:CoreBluetooth] Sending XPC message 1: {
    kCBMsgArgName = "TestApp";
    kCBMsgArgOptions =     {
        kCBInitOptionRestoreIdentifier = SuperUnique;
        kCBInitOptionShowPowerAlert = 1;
        kCBManagerPrivacySupported = 0;
    };
    kCBMsgArgType = 0;
    kCBMsgArgVersion = 20161219;
}
Default 0x0 152    0 bluetoothd: [com.apple.bluetooth:Server.XPC] Received XPC message "CBMsgIdCheckIn" from session ""
**Error  0x0  152    0    bluetoothd: [com.apple.bluetooth:Server.XPC] No XPC object for key: kCBMsgArgType**

My question is not about the permissions for Bluetooth and more about how severe this error is or if it is a red herring. Does this mean my IPC message to bluetoothd failed to be delivered? If so, how would XPC issues like this normally occur? SDK version mismatch? Is there any way to get more debugging information?


Solution

  • I upgraded from XCode 12.5.0 to 13.2.1 and the problem is resolved. It seems to have been an SDK mismatch and therefore the XPC messages were not being deserialized properly.

    It would be good to get a more robust answer of how XPC messages work but I have not found a lot of resources on that. In lieu of that I can at least say this has solved the problem.