File tree Expand file tree Collapse file tree 1 file changed +13
-5
lines changed Expand file tree Collapse file tree 1 file changed +13
-5
lines changed Original file line number Diff line number Diff line change @@ -97,13 +97,21 @@ Create a Kotlin file in your commonMain e.g. `AppSetup.kt` or however you want t
9797``` Kotlin
9898import io.sentry.kotlin.multiplatform.Context
9999import io.sentry.kotlin.multiplatform.Sentry
100+ import io.sentry.kotlin.multiplatform.OptionsConfiguration
100101
101102// The context is needed for Android initializations
102- fun initializeSentry (context : Context ? ) {
103- Sentry .init (context) {
104- it.dsn = " __DSN__"
105- }
103+ fun initializeSentry (context : Context ) {
104+ Sentry .init (context, optionsConfiguration())
105+ }
106+
107+ fun initializeSentry () {
108+ Sentry .init (optionsConfiguration())
106109}
110+
111+ private fun optionsConfiguration (): OptionsConfiguration = {
112+ it.dsn = " __DSN__"
113+ }
114+
107115```
108116
109117Now call this function in an early lifecycle stage in your platforms.
@@ -131,7 +139,7 @@ class AppDelegate: NSObject, UIApplicationDelegate {
131139 _ application : UIApplication,
132140 didFinishLaunchingWithOptions launchOptions : [UIApplication.LaunchOptionsKey : Any ]? = nil
133141 ) -> Bool {
134- AppSetupKt.initializeSentry (context = nil )
142+ AppSetupKt.initializeSentry ()
135143 return true
136144 }
137145}
You can’t perform that action at this time.
0 commit comments