ionic-ble-examples icon indicating copy to clipboard operation
ionic-ble-examples copied to clipboard

Object(...) is not a function

Open sergiocarral1 opened this issue 6 years ago • 4 comments

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';

sergiocarral1 avatar Dec 26 '18 00:12 sergiocarral1

@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.

blstechds avatar Jan 24 '19 14:01 blstechds

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

V4NDER avatar Mar 15 '19 13:03 V4NDER

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.

monkeytronics avatar Nov 27 '19 04:11 monkeytronics

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/

Darkmagister avatar Oct 22 '20 15:10 Darkmagister