xamarin / Monkey.BluetoothLE

BluetoothLE abstraction for use with Xamarin projects, including Xamarin.Forms.
Apache License 2.0
349 stars 223 forks source link

IOS adapter not set in BLEExplorer demo #72

Open phice opened 6 years ago

phice commented 6 years ago

I've managed to get it work with Android, with IOS I get a null reference error because in the Appdelegate the adapter is not set (like in android):

App.SetAdapter(new Robotics.Mobile.Core.Bluetooth.LE.Adapter());

how can I fix it?

henrikberg commented 4 years ago

I added SetAdaptor() in AppDelegate.cs.

     public override bool FinishedLaunching(UIApplication app, NSDictionary options)
     {
         global::Xamarin.Forms.Forms.Init();

Today (2020) in iOS you also need to add some lines to info.plist

<key>NSBluetoothAlwaysUsageDescription</key>
<string>Connection to ... require Bluetooth. Please accept the connection.</string>
<key>NSBluetoothPeripheralUsageDescription</key>
<string>Connection to ... require Bluetooth. Please accept the connection.</string>

After that the demo worked.

CONSISSFBanuelos commented 4 years ago

using Robotics.Mobile.Core.Bluetooth.LE;

in AppDelegate.cs.

making reference and complementing the solution of: @henrikberg(up)