Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

BLE not available in iOS simulator #552

Closed
sarink opened this issue Jul 8, 2023 · 3 comments
Closed

BLE not available in iOS simulator #552

sarink opened this issue Jul 8, 2023 · 3 comments
Labels
bug Something isn't working

Comments

@sarink
Copy link

sarink commented Jul 8, 2023

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.

@sarink sarink added the bug Something isn't working label Jul 8, 2023
@pwespi
Copy link
Member

pwespi commented Jul 10, 2023

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.

@pwespi pwespi closed this as completed Jul 10, 2023
@sarink
Copy link
Author

sarink commented Jul 11, 2023

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

@pwespi
Copy link
Member

pwespi commented Jul 11, 2023

Good idea. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants