I have been working on a new project, one that involves Xamarin Forms and communicating with IOT devices over BluetoothLE. BluetoothLE is a very new thing for me, and I have been struggling a bit with getting it setup.
Did I mention that I am not that familiar with iOS dev work? Or Apple for that matter? When starting up my application, it crashed the moment I tried to access the BLE adapter with this message:
Got a SIGABRT while executing native code. This usually indicates a fatal error in the mono runtime or one of the native libraries.
I had no idea what this actually meant. I had the above library sample app and it worked fine. I did some digging and found a post on the Xamarin Forms forums which said this usually corresponds to a privacy issue. And you can use the device logs to figure out which one. I wish I had kept that post so I could attribute it better.
I am using Visual Studio, so in the
View | Other Windows there is a
Device Log that will give you a view into your device. Be aware, it is literally a fire hose: stop and clear the log before you start your app and it will hopefully reduce some of the clutter.
I did find out that it was indeed a permission issue! I needed to add
NSBluetoothPeripheralUsageDescription key and text prompt to the info.plist file. Once added, I was back in business.