简体   繁体   中英

SENTRY IOS SDK not sending events

I'm using Sentry ios sdk v7.31.5

but it never sends events to sentry dashboard "issues" or maybe it's sent but never shows up in the dashboard

I tried capturing custom message

SentrySDK.capture(message: "TESTING SENTRY IOS")

but it never shows up

You have to ensure to start the SDK before sending events. On iOS, Sentry recommends doing this in application:didFinishLaunchingWithOptions

import Sentry // Make sure you import Sentry

// ....

func application(_ application: UIApplication,
    didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {

    SentrySDK.start { options in
        options.dsn = "Your DSN"
    }

    return true
}

If you use SwiftUI, do it in the App conformer's initializer :

import Sentry

@main
struct SwiftUIApp: App {
    init() {
        SentrySDK.start { options in
            options.dsn = "YOUR DSN"
    }
}

You can find more info here https://docs.sentry.io/platforms/apple/guides/ios/ .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM