32feet
32feet copied to clipboard
Xamarin Mac - PlatformNotSupported exception
When trying to create a new BluetoothClient, I get this exception:
System.PlatformNotSupportedException: Operation is not supported on this platform. at InTheHand.Net.Sockets.BluetoothClient..ctor () [0x0000e] in <94af572180da485e94ec3b79bdd26b9c>:0 at BrainBluetoothDetection.AppDelegate.DidFinishLaunching (Foundation.NSNotification notification) [0x00001] in /Users/gabriel/Projects/BrainBluetoothDetection/BrainBluetoothDetection/AppDelegate.cs:16 at at (wrapper managed-to-native) AppKit.NSApplication.NSApplicationMain(int,intptr) at AppKit.NSApplication.Main (System.String[] args) [0x00048] in /Library/Frameworks/Xamarin.Mac.framework/Versions/9.3.0.23/src/Xamarin.Mac/AppKit/NSApplication.cs:119 at BrainBluetoothDetection.MainClass.Main (System.String[] args) [0x00007] in /Users/gabriel/Projects/BrainBluetoothDetection/BrainBluetoothDetection/Main.cs:10
I am on MacOS Ventura 13.0.1. I have the NuGet packages IOBluetooth, .Net.Bluetooth, .IOBluetoothUI, and Bluetooth.Permissions installed. I'm using Visual Studio for Mac. You can have a look at my project here:
Archive.zip
Unfortunately, I have had a ton of trouble with all this, and as a result, there may be things like duplicate SDKS on my computer. I specifically remember installing Xamarin multiple times, had to reinstall XCode quite a few times, as well as Android Studio. I also tried initially with JetBrains rider but it just didn't work (frameworks weren't found).
Bluetooth Classic is not currently implemented for macOS. The underlying IOBluetooth binding library is available so you can use the low level API at a push.
Ah, that's unfortunate. I made a PRQ to clarify that in the README, assuming that it's available on Linux too.
Reopening just to ask: do you know of any good Bluetooth libraries (C# or other lang) for making a bluetooth application from Mac? I found jSerialComm but I'm not sure if that's ideal.