Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/ionic-framework/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ionic framework 为什么Crashlytics函数没有定义?_Ionic Framework_Ionic2_Crash_Crashlytics_Google Fabric - Fatal编程技术网

Ionic framework 为什么Crashlytics函数没有定义?

Ionic framework 为什么Crashlytics函数没有定义?,ionic-framework,ionic2,crash,crashlytics,google-fabric,Ionic Framework,Ionic2,Crash,Crashlytics,Google Fabric,我已经在我的爱奥尼亚2项目中安装了cordova fabric插件。之后,我在FabricHandlerError中扩展了IonicHandlerError(代码如下)。问题是,当缓存的错误到达时,Crashlytics被定义,所有函数都出现在控制台中,但当您使用它时,它们是未定义的 import {Injectable} from "@angular/core"; import {IonicErrorHandler } from 'ionic-angular'; import { Crashl

我已经在我的爱奥尼亚2项目中安装了cordova fabric插件。之后,我在FabricHandlerError中扩展了IonicHandlerError(代码如下)。问题是,当缓存的错误到达时,Crashlytics被定义,所有函数都出现在控制台中,但当您使用它时,它们是未定义的

import {Injectable} from "@angular/core";
import {IonicErrorHandler } from 'ionic-angular';
import { Crashlytics } from '@ionic-native/fabric';

@Injectable()
export class FabricErrorHandler extends IonicErrorHandler {
    constructor (public crashlytics: Crashlytics) {
        super();
    }

    handleError(error: any): void {
        console.log('In Fabric Error Handler');
        console.log(error);
        this.crashlytics.addLog(error.message);
        this.crashlytics.sendCrash();
        console.log('Crashlytics Sended. Error message: '+ error.message);

        super.handleError(error);
    }
}
在控制台中,在处理程序中停止错误:

this.crashlytics
  Crashlytics {}
    __proto__: IonicNativePlugin
   addLog: ƒ ()
   constructor: ƒ Crashlytics()
   recordError: ƒ ()
   sendCrash: ƒ ()
   sendNonFatalCrash: ƒ ()
   setBoolValueForKey: ƒ ()
   setFloatValueForKey: ƒ ()
   setIntValueForKey: ƒ ()
   setStringValueForKey: ƒ ()
   setUserEmail: ƒ ()
   setUserIdentifier: ƒ ()
   setUserName: ƒ ()
   __proto__: Object

this.crashlytics.addLog('ERROR TESTING');
  undefined

this.crashlytics.sendCrash();
  undefined

你是如何初始化插件的?