blakgeek / cordova-plugin-flurryanalytics

Adds support for all that Flurry Analytics flavored goodness to your Cordova based apps
23 stars 29 forks source link

ERROR TypeError: Object(...) is not a function #36

Open saberprashant opened 5 years ago

saberprashant commented 5 years ago

Hi, I am getting this error when I tried to log an event using this plugin.

The code I used in my insights.ts(one of my component) in ionViewWillEnter() :

const options: FlurryAnalyticsOptions = {
      appKey: 'my key', // REQUIRED
      userId: 'prash1234',
      reportSessionsOnClose: true,
      enableLogging: true
    }

let fa: FlurryAnalyticsObject = this.flurry.create(options);

    let ovenParams = {
      temp: 350,
      mode: 'convection',
      rackPosition: 'center'
    }

    fa.logEvent('set oven', ovenParams)
      .then(() => { console.log('something')})
      .catch((e) => console.log('error')); 

Error I get when I run the app:

ERROR TypeError: Object(...) is not a function
    at FlurryAnalyticsObject.logEvent (index.js:26)
    at InsightsPage.webpackJsonp.171.InsightsPage.ionViewWillEnter (insights.ts:60)
    at ViewController._lifecycle (view-controller.js:566)
    at ViewController._willEnter (view-controller.js:454)
    at Tab.NavControllerBase._willEnter (nav-controller-base.js:966)
    at nav-controller-base.js:828
    at t.invoke (polyfills.js:3)
    at Object.onInvoke (core.es5.js:4149)
    at t.invoke (polyfills.js:3)
    at r.run (polyfills.js:3)

My package json:

{
  "name": "myFlurryApp",
  "version": "0.0.1",
  "author": "Ionic Framework",
  "homepage": "http://ionicframework.com/",
  "private": true,
  "scripts": {
    "clean": "ionic-app-scripts clean",
    "build": "ionic-app-scripts build",
    "lint": "ionic-app-scripts lint",
    "ionic:build": "ionic-app-scripts build",
    "ionic:serve": "ionic-app-scripts serve"
  },
  "dependencies": {
    "@angular/common": "4.1.3",
    "@angular/compiler": "4.1.3",
    "@angular/compiler-cli": "4.1.3",
    "@angular/core": "4.1.3",
    "@angular/forms": "4.1.3",
    "@angular/http": "4.1.3",
    "@angular/platform-browser": "4.1.3",
    "@angular/platform-browser-dynamic": "4.1.3",
    "@ionic-native/app-version": "^4.19.0",
    "@ionic-native/core": "^4.19.0",
    "@ionic-native/device": "^4.19.0",
    "@ionic-native/fcm": "^4.5.2",
    "@ionic-native/flurry-analytics": "^5.2.0",
    "@ionic-native/google-analytics": "^4.19.0",
    "@ionic-native/keyboard": "^4.19.0",
    "@ionic-native/local-notifications": "^4.6.0",
    "@ionic-native/push": "4.0.1",
    "@ionic-native/splash-screen": "^4.19.0",
    "@ionic-native/status-bar": "^4.19.0",
    "@ionic/storage": "2.0.1",
    "@types/lodash": "^4.14.91",
    "cordova-android": "7.1.4",
    "cordova-ios": "4.5.5",
    "cordova-plugin-app-version": "0.1.9",
    "cordova-plugin-badge": "0.8.8",
    "cordova-plugin-cocoapod-support": "1.6.0",
    "cordova-plugin-device": "2.0.2",
    "cordova-plugin-fcm-with-dependecy-updated": "2.4.0",
    "cordova-plugin-flurryanalytics": "1.4.6",
    "cordova-plugin-google-analytics": "1.8.6",
    "cordova-plugin-ionic-keyboard": "2.1.3",
    "cordova-plugin-local-notification": "0.9.0-beta.2",
    "cordova-plugin-splashscreen": "5.0.2",
    "cordova-plugin-statusbar": "2.4.2",
    "cordova-plugin-whitelist": "1.3.3",
    "datepicker-ionic2": "^2.6.2",
    "highcharts": "^4.2.6",
    "ion2-calendar": "^2.2.0",
    "ionic-angular": "3.6.1",
    "ionic-select-searchable": "^2.8.2",
    "ionicons": "3.0.0",
    "moment": "^2.22.2",
    "rxjs": "^5.5.12",
    "sw-toolbox": "3.6.0",
    "zone.js": "0.8.12"
  },
  "devDependencies": {
    "@ionic/app-scripts": "2.1.4",
    "typescript": "2.3.4"
  },
  "description": "An Ionic project",
  "cordova": {
    "plugins": {
      "cordova-plugin-app-version": {},
      "cordova-plugin-device": {},
      "cordova-plugin-ionic-keyboard": {},
      "cordova-plugin-splashscreen": {},
      "cordova-plugin-statusbar": {},
      "cordova-plugin-whitelist": {},
      "cordova-plugin-google-analytics": {
        "GMS_VERSION": "11.0.1"
      },
      "cordova-plugin-fcm-with-dependecy-updated": {},
      "cordova-plugin-local-notification": {},
      "cordova-plugin-flurryanalytics": {}
    },
    "platforms": [
      "ios",
      "android"
    ]
  }
}

ionic -v 4.3.0

Android 7.1.4

Please help me with this. Thanks :)

achakra21 commented 3 years ago

This is more likely issue with the version mismatch with your ionic and flurry plugin plus,angular like some methods are written in this flurry are not compatible with current version of angular what you can do playaround with the lower version of your flurry plugin , It should work

Like @ionic-native/flurry-analytics": "^5.2.0", to @ionic-native/flurry-analytics": "4.....something",