【发布时间】:2019-08-01 04:33:26
【问题描述】:
当我尝试使用 Flurry 插件记录事件时出现此错误: https://github.com/blakgeek/cordova-plugin-flurryanalytics
(我在使用 firebase-analytics 插件时遇到了同样的错误,我也无法解决这个问题: https://github.com/chemerisuk/cordova-plugin-firebase-analytics)
我在insights.ts(one of my component) 中使用的代码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 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)
我的包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"
]
}
}
离子 -v
4.3.0
安卓
7.1.4
请帮我解决这个问题。 谢谢:)
【问题讨论】:
-
其实你的离子版本是什么?因为在您的问题中您提到了 v4,并且在标签中您使用的是
ionic3标签。 -
嗨@SudarshanaDayananda,我正在使用ionic cli-4.3.0,但我制作的项目是针对ionic 3的。这就是我提到ionic-3的原因
-
还有一件事,我什至尝试将 cli 版本从
4.3.0更改为3.12.x但问题是一样的。 -
你能解决这个问题吗?
-
@AbhijitChakra,是的,我可以通过切换 Flurry 插件的版本来解决这个问题。然后在android文件中更改服务(flurry服务)的版本。 PS:虽然我不会推荐这个插件,但是当你构建你的iOS项目时它会导致一个大问题。如果他们去年解决了 iOS 的构建问题,那么您肯定可以使用它。
标签: cordova ionic-framework ionic3 firebase-analytics flurry-analytics