sentry-cocoa
sentry-cocoa copied to clipboard
Improve support for Kotlin Native
Problem Statement
I have been playing with Sentry in a Kotlin Multiplatform iOS app.
So far I have been able to successfully log a fatal Kotlin exception. However it currently requires using a lot of private APIs.
Solution Brainstorm
To convert a Kotlin Exception to a SentryException we'll need something like:
@interface SentryStacktrace ()
+ (SentryStacktrace *)stacktraceFromCallStackReturnAddresses:(NSArray<NSNumber *> *)callStackReturnAddresses;
@end
All the logic already exists, but it currently requires using SentryStacktraceBuilder and SentryCrashStackCursor.
The other API that's missing is a way to store a crash event.
Currently there is storeEnvelope (which is also private) which requires a lot of private APIs to create a SentryEnvelope.
Something like the following (that internally prepares the event and creates the envelope) would be great.
@interface SentrySDK ()
+ (void)storeCrashEvent:(SentryEvent *)event;
@end
Hey @rickclephas thanks for this. It looks like a nice use case. We gonna look into it.
This issue has gone three weeks without activity. In another week, I will close it.
But! If you comment or otherwise update it, I will reset the clock, and if you label it Status: Backlog or Status: In Progress, I will leave it alone ... forever!
"A weed is but an unloved flower." ― Ella Wheeler Wilcox 🥀
@buenaflor, you worked on the Kotlin Multiplatform in the past weeks. Isn't that issue already fixed? Or how did you work around the issue again?
This issue has gone three weeks without activity. In another week, I will close it.
But! If you comment or otherwise update it, I will reset the clock, and if you label it Status: Backlog or Status: In Progress, I will leave it alone ... forever!
"A weed is but an unloved flower." ― Ella Wheeler Wilcox 🥀
Should be fixed with https://github.com/getsentry/sentry-kotlin-multiplatform/pull/20. Feel free to open if not.
@philipphofmann I don't think that really solves the "problem". That PR uses similar logic to what I have used, which relies on a number of private APIs.
I feel like it would be better to officially support this in the Cocoa SDK.
A KMP SDK is great, but one of the biggest strengths of KMP is its ability to integrate with native projects. Providing the required APIs as part of the public API would improve the KMP experience. It would also decouple the KMP SDK from the Cocoa SDK, allowing it to focus on improving the Kotlin experience without having to worry too much about the underlying native SDKs.
This issue has gone three weeks without activity. In another week, I will close it.
But! If you comment or otherwise update it, I will reset the clock, and if you label it Status: Backlog or Status: In Progress, I will leave it alone ... forever!
"A weed is but an unloved flower." ― Ella Wheeler Wilcox 🥀