Skip to content
This repository has been archived by the owner on Jun 19, 2024. It is now read-only.

IOS adapter not set in BLEExplorer demo #72

Open
phice opened this issue Jan 31, 2018 · 2 comments
Open

IOS adapter not set in BLEExplorer demo #72

phice opened this issue Jan 31, 2018 · 2 comments

Comments

@phice
Copy link

phice commented Jan 31, 2018

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
Copy link

I added SetAdaptor() in AppDelegate.cs.

     public override bool FinishedLaunching(UIApplication app, NSDictionary options)
     {
         global::Xamarin.Forms.Forms.Init();
  •        App.SetAdapter(Adapter.Current);
           LoadApplication(new App());
           return base.FinishedLaunching(app, options);
       }
    

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
Copy link

CONSISSFBanuelos commented Jun 18, 2020

using Robotics.Mobile.Core.Bluetooth.LE;

in AppDelegate.cs.

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

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants