capacitor-community/bluetooth-le

BLE not available in iOS simulator

sarink opened this issue · 3 comments

sarink commented

Describe the bug
Can't seem to get this to work in iOS, not sure what steps to take to begin debugging? I can't get the lib to work at all

To Reproduce
I have a capacitor app with the correct Info.plist parameters added (as specified by the readme in this repo), and have written the following simple react component:

import { BleClient } from '@capacitor-community/bluetooth-le';
import { Bluetooth } from '@mui/icons-material';
import React from 'react';

export const DashboardPage = () => {
  return (
    <div>
      <button
        onClick={() => {
          BleClient.initialize()
            .then(() => {
              alert('BLE available');
            })
            .catch(() => {
              alert('BLE not available');
            });
        }}
      >
        Scan for bluetooth devices
      </button>
    </div>
  );
};

Expected behavior
When clicking the button, it alerts that ble is not available

Plugin version:

    "@capacitor-community/bluetooth-le": "^3.0.0",
    "@capacitor/android": "^5.1.1",
    "@capacitor/app": "^5.0.5",
    "@capacitor/browser": "^5.0.5",
    "@capacitor/core": "^5.1.1",
    "@capacitor/ios": "^5.1.1",

Smartphone (please complete the following information):
iPhone 14 simulator

Additional context
Add any other context about the problem here.

pwespi commented

Smartphone (please complete the following information):
iPhone 14 simulator

Bluetooth is not available in the iOS simulator. You have to test with a real device.

sarink commented

Oh, didn't realize that. Might be nice to mention it in the docs. Thanks!

pwespi commented

Good idea. Thanks!