sarriaroman / FabricPlugin

Fabric.io plugin for Cordova or Phonegap
MIT License
198 stars 159 forks source link

Using recordError method iOS App Crashed - Plugin - 1.1.14-dev #148

Open lav-sttl opened 5 years ago

lav-sttl commented 5 years ago

Ionic Info : Ionic:

ionic (Ionic CLI) : 4.5.0 (/usr/local/lib/node_modules/ionic) Ionic Framework : ionic-angular 3.9.2 @ionic/app-scripts : 3.1.2

Cordova:

cordova (Cordova CLI) : 8.1.2 (cordova-lib@8.1.1) Cordova Platforms : android 7.1.1, ios 4.5.5 Cordova Plugins : no whitelisted plugins (14 plugins total)

System:

ios-deploy : 2.0.0 ios-sim : 7.0.0 NodeJS : v8.11.3 (/usr/local/bin/node) npm : 5.6.0 OS : macOS High Sierra Xcode : Xcode 9.4 Build version 9F1027a

Plugin Used config.xml Files contains

screen shot 2019-01-02 at 3 37 13 pm

Tested Device iPhone 6 Plus - OS - 12.1

Actual Behaviour : App crashed and user can't do anything. User can't use after relaunch app again.

Expected Behaviour: App should not be crashed and I just want to Add logs on Fabric Crashlytics.

Step to Produced:

1) Called addLog Method : Add Logs 2019-01-02 15:19:37.311726+0530 MyIonicApp[2760:412919] HomePage onLocationError - User denied location permission! --- TimeStamp: 1546422576932 --- DateTime: Wed Jan 02 2019 15:19:36 GMT+0530 (IST)

2) Called this method after AddLogs method called. recordError('Error',-1);

Injectable service file

screen shot 2019-01-02 at 3 51 07 pm

Debug Logs:

2019-01-02 15:19:37.311941+0530 WebClock[2760:412919] -[NSCFNumber length]: unrecognized selector sent to instance 0xb000000000000013 2019-01-02 15:19:37.316504+0530 WebClock[2760:412919] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[NSCFNumber length]: unrecognized selector sent to instance 0xb000000000000013' *** First throw call stack: (0x1f5d8fea0 0x1f4f61a40 0x1f5ca8d04 0x1f5d957b8 0x1f5d9745c 0x1f5dd5788 0x1f6722884 0x1012b2144 0x1012b2408 0x1013c3688 0x1013c2f7c 0x1013b91dc 0x1013c6040 0x1013b903c 0x1f684239c 0x1f5d201cc 0x1f5d2014c 0x1f5d1fa84 0x1f5d1a8fc 0x1f5d1a1cc 0x1f7f91584 0x222e15054 0x10129e004 0x1f57dabb4) libc++abi.dylib: terminating with uncaught exception of type NSException (lldb)

Is this expected behavior?

twltony commented 5 years ago

same issue, any update?

Ionic:

ionic (Ionic CLI) : 4.0.6 (/usr/local/lib/node_modules/ionic) Ionic Framework : ionic-angular 3.9.2 @ionic/app-scripts : 3.1.8

Cordova:

cordova (Cordova CLI) : 8.1.2 (cordova-lib@8.1.1) Cordova Platforms : android 7.1.4, ios 4.5.5

System:

Android SDK Tools : 26.1.1 ios-deploy : 2.0.0 ios-sim : 6.0.0 NodeJS : v10.8.0 (/usr/local/bin/node) npm : 6.2.0 OS : macOS High Sierra Xcode : Xcode 10.1 Build version 10B61

allanpoppe commented 5 years ago

Same issue here.

marioperino commented 5 years ago

Same issue here also

maurotrigo commented 5 years ago

+1

taras101 commented 5 years ago

+1

amymarsh4work commented 4 years ago

I had this problem too. Now I have it working. I believe what I was doing wrong was that I was passing an instance of Error into the reportError method as the first parameter. It needs to be a string.

It helped me to look at: ./plugins/cordova-fabric-plugin/typings/cordova-fabric-plugin.d.ts: // Used to record a non-fatal error message (iOS only). recordError(message: string, code: number): void;

Solution (simplified): handleError(error: any) { const errMsg = this.extractMessage(error); this.sendErrorReport(errMsg); }

private extractMessage(error: any): string { return (error.message) ? error.message : (error.statusText) ? error.statusText : error.toString(); }

private sendErrorReport(message): void { if (this.iOS) { const code = 0; this.crashlytics.recordError(message, code); } else { this.crashlytics.sendNonFatalCrash(message); } }