sitefinitysteve / nativescript-google-analytics

Apache License 2.0
23 stars 14 forks source link

Error calling logException on iOS #31

Closed coltcook closed 6 years ago

coltcook commented 7 years ago

First let me say thanks for writing this plugin! When we were picking which framework to go with at work I experimented with GA on NS and I wasn't excited about writing my own.

Anyway, on a brand new Angular 2 NativeScript project based on the hello world template (tns create --ng), following your example for initializing, the app crashes when trying to log an exception on iOS (Android is fine).

The short error is: JS ERROR Error: This value is not a native object.

In a simple (tap) function this code is used:

    let exception: LogExceptionOptions = <LogExceptionOptions>{
            description: `Button has been clicked ${this.count + 1} times!`,
            fatal: false
    };

    googleAnalytics.logException(exception);

And here's the console output from Zombies:

CONSOLE LOG file:///app/app.module.js:49:28: iOS {"line":96,"column":35,"sourceURL":"file:///app/tns_modules/nativescript-google-analytics/index.js"} Fatal JavaScript exception - application has been terminated. Native stack trace: 1 0x10d33c7cb NativeScript::FFICallback::ffiClosureCallback(ffi_cif, void, void*, void) 2 0x10da111ee ffi_closure_unix64_inner 3 0x10da11b22 ffi_closure_unix64 4 0x10e665c38 -[UIControl sendAction:to:forEvent:] 5 0x10e665f51 -[UIControl _sendActionsForEvents:withEvent:] 6 0x10e664e4d -[UIControl touchesEnded:withEvent:] 7 0x10e54d545 -[UIWindow _sendTouchesForEvent:] 8 0x10e54ec33 -[UIWindow sendEvent:] 9 0x10e4fb9ab -[UIApplication sendEvent:] 10 0x10ece872d dispatchPreprocessedEventFromEventQueue 11 0x10ece1463 handleEventQueue 12 0x10c2a7761 CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION 13 0x10c28c98c CFRunLoopDoSources0 14 0x10c28be76 CFRunLoopRun 15 0x10c28b884 CFRunLoopRunSpecific 16 0x110d3fa6f GSEventRunModal 17 0x10e4ddc68 UIApplicationMain 18 0x10da1197d ffi_call_unix64 19 0x12ce0c2c0 JavaScript stack trace: 1 send@file:///app/tns_modules/nativescript-google-analytics/index.js:96:35 2 logException@file:///app/tns_modules/nativescript-google-analytics/index.js:96:35 3 onTap@file:///app/item/items.component.js:25:37 4 handleEvent_5@:151:39 5 @[native code] 6 @file:///app/tns_modules/nativescript-angular/renderer.js :213:31 7 invoke@file:///app/tns_modules/nativescript-angular/zone-js/dist/zone-nativescript.js:190:33 8 onInvoke@file:///app/tns_modules/@angular/core/bundles/core.umd.js:4391:47 9 invoke@file:///app/tns_modules/nativescript-angular/zone-js/dist/zone-nativescript.js:189:42 10 run@file:///app/tns_modules/nativescript-angular/zone-js/dist/zone-nativescript.js:83:49 11 zonedCallback@file:///app/tns_modules/nativescript-angular/renderer.js:212:27 12 notify@file:///app/tns_modules/tns-core-modules/data/observable/observable.js:149:31 13 _emit@file:///app/tns_modules/tns-core-modules/data/observable/observable.js:168:24 14 tap@file:///app/tns_modules/tns-core-modules/ui/button/button.js:21:24 15 UIApplicationMain@[native code] 16 start @file:///app/tns_modules/tns-core-modules/application/application.js:251:26 17 bootstrapApp@file:///app/tns_modules/nativescript-angular/platform-common.js:68:28 18 bootstrapModule@file:///app/tns_modules/nativescript-angular/platform-common.js:56:26 19 anonymous@file:///app/main.js:5:57 20 evaluate@[native code] 21 moduleEvaluation@[native code] 22 @[native code] 23 promiseReactionJob@[native code] JavaScript error: file:///app/tns_modules/nativescript-google-analytics/index.js:96:35: JS ERROR Error: This value is not a native object.

sitefinitysteve commented 7 years ago

Hey! Sorry for the late reply. I can't speak to any NG stuff but I'll finally test this again in the demo!

I'll get back to you shortly

On Mar 14, 2017 12:30 PM, "coltcook" notifications@github.com wrote:

First let me say thanks for writing this plugin! When we were picking which framework to go with at work I experimented with GA on NS and I wasn't excited about writing my own.

Anyway, on a brand new Angular 2 NativeScript project based on the hello world template (tns create --ng), following your example for initializing, the app crashes when trying to log an exception on iOS (Android is fine).

The short error is: JS ERROR Error: This value is not a native object.

In a simple (tap) function this code is used:

let exception: LogExceptionOptions = <LogExceptionOptions>{
        description: `Button has been clicked ${this.count + 1} times!`,
        fatal: false
};

googleAnalytics.logException(exception);

And here's the console output from Zombies:

CONSOLE LOG file:///app/app.module.js:49:28: iOS {"line":96,"column":35," sourceURL":"file:///app/tns_modules/nativescript-google- analytics/index.js"} Fatal JavaScript exception - application has been terminated. Native stack trace: 1 0x10d33c7cb NativeScript::FFICallbackNativeScript::ObjCMethodCallback::ffiClosureCallback(ffi_cif, void, void*, void) 2 0x10da111ee ffi_closure_unix64_inner 3 0x10da11b22 ffi_closure_unix64 4 0x10e665c38 -[UIControl sendAction:to:forEvent:] 5 0x10e665f51 -[UIControl _sendActionsForEvents:withEvent:] 6 0x10e664e4d -[UIControl touchesEnded:withEvent:] 7 0x10e54d545 -[UIWindow _sendTouchesForEvent:] 8 0x10e54ec33 -[UIWindow sendEvent:] 9 0x10e4fb9ab -[UIApplication sendEvent:] 10 0x10ece872d dispatchPreprocessedEventFromEventQueue 11 0x10ece1463 handleEventQueue 12 0x10c2a7761 CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION 13 0x10c28c98c CFRunLoopDoSources0 14 0x10c28be76 CFRunLoopRun 15 0x10c28b884 CFRunLoopRunSpecific 16 0x110d3fa6f GSEventRunModal 17 0x10e4ddc68 UIApplicationMain 18 0x10da1197d ffi_call_unix64 19 0x12ce0c2c0 JavaScript stack trace: 1 send@file:///app/tns_modules/nativescript-google-analytics/ index.js:96:35 2 logException@file:///app/tns_modules/nativescript-google- analytics/index.js:96:35 3 onTap@file:///app/item/items.component.js:25:37 4 handleEvent_5@:151:39 5 @[native code] 6 @file https://github.com/file:///app/tns_modules/ nativescript-angular/renderer.js :213:31 7 invoke@file:///app/tns_modules/nativescript-angular/zone-js/dist/zone- nativescript.js:190:33 8 onInvoke@file:///app/tns_modules/@angular/core/bundles/ core.umd.js:4391:47 9 invoke@file:///app/tns_modules/nativescript-angular/zone-js/dist/zone- nativescript.js:189:42 10 run@file:///app/tns_modules/nativescript-angular/zone-js/ dist/zone-nativescript.js:83:49 11 zonedCallback@file:///app/tns_modules/nativescript-angular/ renderer.js:212:27 12 notify@file:///app/tns_modules/tns-core-modules/data/ observable/observable.js:149:31 13 _emit@file:///app/tns_modules/tns-core-modules/data/ observable/observable.js:168:24 14 tap@file:///app/tns_modules/tns-core-modules/ui/button/button.js:21:24 15 UIApplicationMain@[native code] 16 start @file https://github.com/file:///app/tns_modules/tns- core-modules/application/application.js:251:26 17 bootstrapApp@file:///app/tns_modules/nativescript-angular/ platform-common.js:68:28 18 bootstrapModule@file:///app/tns_modules/nativescript- angular/platform-common.js:56:26 19 anonymous@file:///app/main.js:5:57 20 evaluate@[native code] 21 moduleEvaluation@[native code] 22 @[native code] 23 promiseReactionJob@[native code] JavaScript error: file:///app/tns_modules/nativescript-google-analytics/index.js:96:35: JS ERROR Error: This value is not a native object.

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/sitefinitysteve/nativescript-google-analytics/issues/31, or mute the thread https://github.com/notifications/unsubscribe-auth/ABeI6AB_D0xuwakvsb-tUEicoMyBWLWRks5rlsCwgaJpZM4Mc0xn .

sitefinitysteve commented 6 years ago

image