inthehand / 32feet

Personal Area Networking for .NET. Open source and professionally supported
https://inthehand.com/components/32feet/
MIT License
834 stars 208 forks source link

Xamarin Mac - PlatformNotSupported exception #376

Open Archonic944 opened 11 months ago

Archonic944 commented 11 months ago

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).

peterfoot commented 11 months ago

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.

Archonic944 commented 11 months ago

Ah, that's unfortunate. I made a PRQ to clarify that in the README, assuming that it's available on Linux too.

Archonic944 commented 11 months ago

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.