Jump to content
vasilius

OSX Sonoma BluetoothLE Delphi 12

Recommended Posts

Please report it to embarcadero

In Delphi 12 and early BluetoothLE will not work in macOS Sonoma

 

How to check problem:
1. Place on the form the BluetoothLE1 component and the Button1.
2. Write code  in the  Button1Click event 

BluetoothLE1.DiscoverDevices(1500);

 

The problem is in the Macapi.Bluetooth.pas.

Here

{$IFDEF IOS}
  libCoreBluetooth = '/System/Library/Frameworks/CoreBluetooth.framework/CoreBluetooth';
{$ELSE}
    libCoreBluetooth = '/System/Library/Frameworks/IOBluetooth.framework/Frameworks/CoreBluetooth.framework/CoreBluetooth';
{$ENDIF}

 

In the new macOS Sonoma (version 14) Bluetooth path is the same like in IOS - '/System/Library/Frameworks/CoreBluetooth.framework/CoreBluetooth';

 

 

Share this post


Link to post

Is this only relevant for the SDK you are using or really for the MacOS-PC the app is running on.

As until now I haven't any problem compiling my app with MacOS SDK 13.3 and running my app an MacOS 14 but I got a problem as I switch to MacOS SDK 14.2.

So my assumption is that the following code is not correct

{$IFDEF IOS}
  libCoreBluetooth = '/System/Library/Frameworks/CoreBluetooth.framework/CoreBluetooth';
{$ELSE}
    if (TOSVersion.MajorVersion>=14) then
      libCoreBluetooth = '/System/Library/Frameworks/CoreBluetooth.framework/CoreBluetooth' 
    else
      libCoreBluetooth = '/System/Library/Frameworks/IOBluetooth.framework/Frameworks/CoreBluetooth.framework/CoreBluetooth';
{$ENDIF}

 

It needs to be something as

{$IFDEF IOS}
  libCoreBluetooth = '/System/Library/Frameworks/CoreBluetooth.framework/CoreBluetooth';
{$ELSE}
    {$IFDEF MACOS_SKD_14F}
      libCoreBluetooth = '/System/Library/Frameworks/CoreBluetooth.framework/CoreBluetooth'; 
    {$ELSE}
      libCoreBluetooth = '/System/Library/Frameworks/IOBluetooth.framework/Frameworks/CoreBluetooth.framework/CoreBluetooth';
    {$ENDIF}
{$ENDIF}

 

Edited by philipp.hofmann

Share this post


Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×