Skip to content

Commit

Permalink
Fix DSN init in ios13 sample app (#4363)
Browse files Browse the repository at this point in the history
  • Loading branch information
denrase authored Sep 23, 2024
1 parent f78a7f7 commit 2233968
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions Samples/iOS-Swift/iOS13-Swift/AppDelegate.swift
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,16 @@ class AppDelegate: UIResponder, UIApplicationDelegate {

func startSentry() {
// For testing purposes, we want to be able to change the DSN and store it to disk. In a real app, you shouldn't need this behavior.
let dsn: String? = nil
var storedDsn: String?
do {
let dsn = try DSNStorage.shared.getDSN() ?? AppDelegate.defaultDSN
try DSNStorage.shared.saveDSN(dsn: dsn)
storedDsn = try DSNStorage.shared.getDSN()
try DSNStorage.shared.saveDSN(dsn: storedDsn ?? Self.defaultDSN)
} catch {
print("[iOS-Swift] Failed to read/write DSN: \(error)")
}

let dsn = storedDsn ?? Self.defaultDSN

SentrySDK.start { options in
options.dsn = dsn
options.debug = true
Expand Down

0 comments on commit 2233968

Please sign in to comment.