NativeScript / ios-jsc

NativeScript for iOS using JavaScriptCore
http://docs.nativescript.org/runtimes/ios
Apache License 2.0
299 stars 59 forks source link

Question/Assistance : Sentry uncaught exceptions for iOS #963

Open tsonevn opened 6 years ago

tsonevn commented 6 years ago

From @bradmartin on July 31, 2018 5:44

Did you verify this is a real problem by searching the NativeScript Forum and the other open issues in this repo?

Yes

Tell us about the problem

Please, ensure your title is less than 63 characters long and starts with a capital letter.

Which platform(s) does your issue occur on?

iOS

Please provide the following version numbers that your issue occurs with:

latest of all (doesn't matter too much here)

Please tell us how to recreate the issue in as much detail as possible.

The best approach would be to get your code running in the NativeScript Playground and share the link with us, along with any additional details or steps to reproduce needed for examining the issue there.

Is there code involved? If so, please share the minimal amount of code needed to recreate the problem.

Yes and no πŸ˜„

I currently am working to improve the nativescript-sentry plugin. I have a working fork here that utilizes only the native SDKs for android/ios πŸ‘, the others right now are hybrid options that use raven-js which isn't completely necessary. However, it does seem to provide a good option with handling the uncaughtException event on iOS - which is the only hang up I have to completing the fully native SDK integration.

This might be better suited for the iOS runtime team also, not entirely sure who would be best to ping on this.

See the following crash logs that sentry provides when the native SDK captures an uncaught exception (the links should be public for viewing without an account):

ios - https://sentry.io/share/issue/4d8200deb1c84e7e81edd83f419a3e7c/ android - https://sentry.io/share/issue/df2b921161264365ab944ce28156f5a4/

You'll notice that the android SDK captures the NativeScript Exception and logs great detail in Sentry. However, iOS doesn't seem to capture/log any decent information about the NS/JS side of things.

The uncaught exception handler for iOS is setup here with this line. The iOS integration doc for the init phase is here on Sentry site.

So my question is - how different are the exceptions that are thrown by the runtimes on android vs. iOS and is anyone perhaps on the NS iOS runtime team familiar enough with Sentry to possible see if the uncaught exception on iOS that gets tracked by the cocoa/ios sentry sdk could be improved to bring parity to what the Android event ends up logging? Maybe there is some way to generate a better iOS error when uncaught exceptions are thrown that I'm unaware of with NS, so really any help to finish off this last piece and the SDK would be completely wrapped natively which might be a good "win" for the NS community and something that Sentry might care to promote/mention as something that works and works well utilizing their native SDKs πŸ˜„.

Again, I just want to reiterate that all of the other methods/usage of the native SDKs works really well. I just can't figure out a way to get a better exception captured on iOS when the uncaught exception error is thrown that crashes the app. Any tips or ideas to try and get this done are appreciated πŸ˜„

Copied from original issue: NativeScript/NativeScript#6136

bradmartin commented 6 years ago

@mbektchiev - https://forum.sentry.io/t/sentry-for-ios-uncaught-exception-help-within-nativescript-framework/4367/5?u=bradmartin so the one replying to me wrote the Cocoa piece πŸ˜„ - he posted how they convert the RN stack trace, and he mentioned interest in improving this to support NS. This is all outside my knowledge of iOS/ObjC so if you want to maybe chime in or anything feel free. Thanks as always ❀️