don / ionic-ble-examples

Ionic Framework Bluetooth Low Energy Examples
102 stars 70 forks source link

Object(...) is not a function #14

Open sergiocarral1 opened 5 years ago

sergiocarral1 commented 5 years ago

Hi,

Sorry if my question doesn't make sense I new with angular and ionic I tried the Scan example and when I launch the ionic serve it returns this error:

PairPage.html:31 ERROR TypeError: Object(...) is not a function at BLE.scan (index.js:28) at PairPage.webpackJsonp.73.PairPage.scan (pair.ts:79) at Object.eval [as handleEvent] (PairPage.html:31) at handleEvent (core.js:13589) at callWithDebugContext (core.js:15098) at Object.debugHandleEvent [as handleEvent] (core.js:14685) at dispatchEvent (core.js:10004) at core.js:10629 at HTMLButtonElement. (platform-browser.js:2628) at t.invokeTask (polyfills.js:3)

Are we taking device and error as function when they are objects?

The only thing that is different is the import: import { BLE } from '@ionic-native/ble/ngx';

blstechds commented 5 years ago

@sergiocarral1 I am facing the exact issue. Did you get it resolved? Please help me. If you have used another library, please suggest. Thanks in advance.

V4NDER commented 5 years ago

I'm having the same problem, has anyone solved?

monkeytronics commented 4 years ago

Hi All. I was looking at the very same issue. I found that by rebiulding my project and specifiying cordova in the ionic start command:

$ ionic start myApp blank --cordova

the error went away. I'm working in Ionic 4, so some other elements of this utorial will not be the same though. For instance, you'll need to change the imports to :

import { BLE } from '@ionic-native/ble/ngx';

hope this helps you.

Darkmagister commented 3 years ago

i'm having the same issue, i tried the @monkeytronics solution but didn't work, also i'm using ionic 5, here the error:

ERROR TypeError: Object(...) is not a function  
    at BLE.scan (vendor.js:81074) 
    at HomePage.webpackJsonp.248.HomePage.scan (main.js:74)  
    at Object.eval [as handleEvent] (HomePage.html:7)  
    at handleEvent (vendor.js:14225)
    at callWithDebugContext (vendor.js:15734)
    at Object.debugHandleEvent [as handleEvent] (vendor.js:15321)
    at dispatchEvent (vendor.js:10640)
    at vendor.js:11265
    at HTMLButtonElement.<anonymous> (vendor.js:40170)
    at t.invokeTask (polyfills.js:3)

also i have created a repo with the source, so you can check if there is something wrong https://github.com/Darkmagister/testble/