From 1d9458fbc77a5bc2b57828183af8273ea3eadd72 Mon Sep 17 00:00:00 2001 From: Andrew McKnight Date: Wed, 9 Apr 2025 10:48:51 -0800 Subject: [PATCH 01/35] wip --- .../iOS-Swift/Base.lproj/Main.storyboard | 20 +- .../Profiling/ProfilingViewController.swift | 23 +- .../iOS-Swift/SentrySDKOverrides.swift | 196 ++++++++++-------- .../iOS-Swift/SentrySDKWrapper.swift | 100 ++++----- 4 files changed, 184 insertions(+), 155 deletions(-) diff --git a/Samples/iOS-Swift/iOS-Swift/Base.lproj/Main.storyboard b/Samples/iOS-Swift/iOS-Swift/Base.lproj/Main.storyboard index 8ea72575ce0..08465b9ec7c 100644 --- a/Samples/iOS-Swift/iOS-Swift/Base.lproj/Main.storyboard +++ b/Samples/iOS-Swift/iOS-Swift/Base.lproj/Main.storyboard @@ -186,6 +186,22 @@ + + + + + + + + + + + + + + + + @@ -478,7 +494,7 @@ - + @@ -883,6 +899,7 @@ + @@ -1564,6 +1581,7 @@ + diff --git a/Samples/iOS-Swift/iOS-Swift/Profiling/ProfilingViewController.swift b/Samples/iOS-Swift/iOS-Swift/Profiling/ProfilingViewController.swift index 702baae3687..15dc08263b0 100644 --- a/Samples/iOS-Swift/iOS-Swift/Profiling/ProfilingViewController.swift +++ b/Samples/iOS-Swift/iOS-Swift/Profiling/ProfilingViewController.swift @@ -61,33 +61,42 @@ class ProfilingViewController: UIViewController, UITextFieldDelegate { } @IBAction func sampleRateEdited(_ sender: UITextField) { - SentrySDKOverrides.Profiling.sampleRate = getSampleRateOverride(field: sender) + var sampleRate = SentrySDKOverrides.Profiling.sampleRate + sampleRate.value = getSampleRateOverride(field: sender) } @IBAction func tracesSampleRateEdited(_ sender: UITextField) { - SentrySDKOverrides.Tracing.sampleRate = getSampleRateOverride(field: sender) + var sampleRate = SentrySDKOverrides.Tracing.sampleRate + sampleRate.value = getSampleRateOverride(field: sender) } @IBAction func profileAppStartsToggled(_ sender: UISwitch) { - SentrySDKOverrides.Profiling.profileAppStarts = sender.isOn + var disableAppStartProfiling = SentrySDKOverrides.Profiling.disableAppStartProfiling + disableAppStartProfiling.set = sender.isOn } @IBAction func defineProfilesSampleRateToggled(_ sender: UISwitch) { sampleRateField.isEnabled = sender.isOn - SentrySDKOverrides.Profiling.sampleRate = getSampleRateOverride(field: sampleRateField) + + var sampleRate = SentrySDKOverrides.Profiling.sampleRate + sampleRate.value = getSampleRateOverride(field: sampleRateField) } @IBAction func defineTracesSampleRateToggled(_ sender: UISwitch) { tracesSampleRateField.isEnabled = sender.isOn - SentrySDKOverrides.Tracing.sampleRate = getSampleRateOverride(field: tracesSampleRateField) + + var sampleRate = SentrySDKOverrides.Tracing.sampleRate + sampleRate.value = getSampleRateOverride(field: tracesSampleRateField) } @IBAction func traceLifecycleToggled(_ sender: UISwitch) { - SentrySDKOverrides.Profiling.manualLifecycle = !sender.isOn + var manualLifecycle = SentrySDKOverrides.Profiling.manualLifecycle + manualLifecycle.set = !sender.isOn } @IBAction func sessionSampleRateChanged(_ sender: UITextField) { - SentrySDKOverrides.Profiling.sessionSampleRate = getSampleRateOverride(field: sender) + var sessionSampleRate = SentrySDKOverrides.Profiling.sessionSampleRate + sessionSampleRate.value = getSampleRateOverride(field: sender) } // MARK: UITextFieldDelegate diff --git a/Samples/iOS-Swift/iOS-Swift/SentrySDKOverrides.swift b/Samples/iOS-Swift/iOS-Swift/SentrySDKOverrides.swift index a027d485e32..01ff9f8116f 100644 --- a/Samples/iOS-Swift/iOS-Swift/SentrySDKOverrides.swift +++ b/Samples/iOS-Swift/iOS-Swift/SentrySDKOverrides.swift @@ -1,113 +1,137 @@ import Foundation -protocol OverrideKey: RawRepresentable, CaseIterable { - var rawValue: String { get } -} - enum SentrySDKOverrides { static let userDefaultOverrideSuffix = "-not-overridden" static let defaults = UserDefaults.standard - + static func resetDefaults() { - for key in Tracing.Key.allCases.map(\.rawValue) + Profiling.Key.allCases.map(\.rawValue) { + for key in Tracing.allCases.map(\.rawValue) + Profiling.allCases.map(\.rawValue) { defaults.removeObject(forKey: key) defaults.set(true, forKey: key + userDefaultOverrideSuffix) } } - - enum Tracing { - enum Key: String, OverrideKey { - case sampleRate = "--io.sentry.tracesSampleRate" - case samplerValue = "--io.sentry.tracesSamplerValue" - } - - static var sampleRate: Float? { + + enum Performance: String { + case disableTimeToFullDisplayTracing = "--disable-time-to-full-display-tracing" + case disablePerformanceV2 = "--disable-performance-v2" + case disableAppHangTrackingV2 = "--disable-app-hang-tracking-v2" + case disableSessionTracking = "--disable-automatic-session-tracking" + case disableFileIOTracing = "--disable-file-io-tracing" + case disableUIVCTracing = "--disable-uiviewcontroller-tracing" + case disableNetworkTracing = "--disable-network-tracking" + case disableCoreDataTracing = "--disable-core-data-tracing" + case disableANRTracking = "--disable-anr-tracking" + case disableWatchdogTracking = "--disable-watchdog-tracking" + case disableUITracing = "--disable-ui-tracing" + case disablePrewarmedAppStartTracing = "--disable-prewarmed-app-start-tracing" + case disablePerformanceTracing = "--disable-auto-performance-tracing" + + var set: Bool { get { - getValueOverride(for: Tracing.Key.sampleRate) + getOverride(for: rawValue) } set(newValue) { - defaults.set(newValue, forKey: Tracing.Key.sampleRate.rawValue) - } - } - - static var samplerValue: Float? { - get { - getValueOverride(for: Tracing.Key.samplerValue) - } - set(newValue) { - defaults.set(newValue, forKey: Tracing.Key.samplerValue.rawValue) + setOverride(for: rawValue, value: newValue) } } } - - enum Profiling { - enum Key: String, OverrideKey { - case sampleRate = "--io.sentry.profilesSampleRate" - case samplerValue = "--io.sentry.profilesSamplerValue" - case disableAppStartProfiling = "--io.sentry.disable-app-start-profiling" - case manualLifecycle = "--io.sentry.profile-lifecycle-manual" - case sessionSampleRate = "--io.sentry.profile-session-sample-rate" - case disableUIProfiling = "--io.sentry.disable-ui-profiling" - } - - static var sampleRate: Float? { - get { - getValueOverride(for: Profiling.Key.sampleRate) - } - set(newValue) { - defaults.set(newValue, forKey: Profiling.Key.sampleRate.rawValue) - } - } - - static var samplerValue: Float? { + + enum Other: String { + case disableAttachScreenshot = "--disable-attach-screenshot" + case disableAttachViewHierarchy = "--disable-attach-view-hierarchy" + case disableSessionReplay = "--disable-session-replay" + case disableMetricKit = "--disable-metrickit-integration" + case disableBreadcrumbs = "--disable-automatic-breadcrumbs" + case disableNetworkBreadcrumbs = "--disable-network-breadcrumbs" + case disableSwizzling = "--disable-swizzling" + case disableCrashHandling = "--disable-crash-handler" + case disableSpotlight = "--disable-spotlight" + + var set: Bool { get { - getValueOverride(for: Profiling.Key.samplerValue) + getOverride(for: rawValue) } set(newValue) { - defaults.set(newValue, forKey: Profiling.Key.samplerValue.rawValue) + setOverride(for: rawValue, value: newValue) } } + } + + enum Tracing: String, CaseIterable { + case sampleRate = "--io.sentry.tracesSampleRate" + case samplerValue = "--io.sentry.tracesSamplerValue" + case disableTracing = "--io.sentry.disable-tracing" - static var sessionSampleRate: Float? { + var set: Bool { get { - getValueOverride(for: Profiling.Key.sessionSampleRate) + switch self { + case .sampleRate, .samplerValue: fatalError("Invalid") + default: getOverride(for: rawValue) + } } set(newValue) { - defaults.set(newValue, forKey: Profiling.Key.sessionSampleRate.rawValue) + switch self { + case .sampleRate, .samplerValue: fatalError("Invalid") + default: setOverride(for: rawValue, value: newValue) + } } } - /// - note: If no other overrides are present, we set the iOS-Swift app to use trace lifecycle (the SDK default is manual) - static var manualLifecycle: Bool { + var value: Float? { get { - getOverride(for: Profiling.Key.manualLifecycle) + switch self { + case .disableTracing: fatalError("Invalid") + default: getValueOverride(for: rawValue) + } } set(newValue) { - setOverride(for: Profiling.Key.manualLifecycle, value: newValue) + switch self { + case .disableTracing: fatalError("Invalid") + default: setOverride(for: rawValue, value: newValue) + } } } - - /// - note: If no other overrides are present, we set the iOS-Swift app to use launch profiling (the SDK default is to disable it) - static var profileAppStarts: Bool { + } + + enum Profiling: String, CaseIterable { + case sampleRate = "--io.sentry.profilesSampleRate" + case samplerValue = "--io.sentry.profilesSamplerValue" + case disableAppStartProfiling = "--io.sentry.disable-app-start-profiling" + case manualLifecycle = "--io.sentry.profile-lifecycle-manual" + case sessionSampleRate = "--io.sentry.profile-session-sample-rate" + case disableUIProfiling = "--io.sentry.disable-ui-profiling" + + var set: Bool { get { - !getOverride(for: Profiling.Key.disableAppStartProfiling) + switch self { + case .sampleRate, .samplerValue, .sessionSampleRate: fatalError("Invalid") + default: getOverride(for: rawValue) + } } set(newValue) { - setOverride(for: Profiling.Key.disableAppStartProfiling, value: !newValue) + switch self { + case .sampleRate, .samplerValue, .sessionSampleRate: fatalError("Invalid") + default: setOverride(for: rawValue, value: newValue) + } } } - - /// allows configuring to use continuous profiling functionality beta - static var disableUIProfiling: Bool { + + var value: Float? { get { - getOverride(for: Profiling.Key.disableUIProfiling) + switch self { + case .disableUIProfiling, .disableAppStartProfiling, .manualLifecycle: fatalError("Invalid") + default: getValueOverride(for: rawValue) + } } set(newValue) { - setOverride(for: Profiling.Key.disableUIProfiling, value: newValue) + switch self { + case .disableUIProfiling, .disableAppStartProfiling, .manualLifecycle: fatalError("Invalid") + default: setOverride(for: rawValue, value: newValue) + } } } } - + /// - note: This returns `false` in the default case. For anything that calls this method, design the API in such a way that by default it responds to this returning `false`, and then if it returns `true`, the override takes effect. Here's the decision tree: /// ``` /// - should schema overrides take precedence @@ -123,46 +147,46 @@ enum SentrySDKOverrides { /// - yes: return the value stored in user defaults /// - no: return false indicating that the override should not take effect /// ``` - private static func getOverride(for key: any OverrideKey) -> Bool { + private static func getOverride(for key: String) -> Bool { let args = ProcessInfo.processInfo.arguments - + if args.contains("--io.sentry.schema-override-precedence") { - guard args.contains(key.rawValue) else { + guard args.contains(key) else { return checkOverride(key) { false } } - + return true } - + return checkOverride(key) { - args.contains(key.rawValue) + args.contains(key) } } - + /// If a key is not present for a bool in user defaults, it returns false, but we need to know if it's returning false because it was overridden that way, or just isn't present, so we provide a way to return a "default value" if the override isn't present in defaults at all (indicated by a "true" value stored for "default X not overridden" key to make this truthy, otherwise return the stored defaults value - private static func checkOverride(_ key: any OverrideKey, defaultValue: () -> Bool) -> Bool { + private static func checkOverride(_ key: String, defaultValue: () -> Bool) -> Bool { let defaults = defaults - - guard !defaults.bool(forKey: key.rawValue + userDefaultOverrideSuffix) else { + + guard !defaults.bool(forKey: key + userDefaultOverrideSuffix) else { return defaultValue() } - - return defaults.bool(forKey: key.rawValue) + + return defaults.bool(forKey: key) } - - private static func setOverride(for key: any OverrideKey, value: Bool) { - defaults.set(value, forKey: key.rawValue) - defaults.set(false, forKey: key.rawValue + userDefaultOverrideSuffix) + + private static func setOverride(for key: String, value: Any?) { + defaults.set(value, forKey: key) + defaults.set(false, forKey: key + userDefaultOverrideSuffix) } - private static func getValueOverride(for key: any OverrideKey) -> T? where T: LosslessStringConvertible { + private static func getValueOverride(for key: String) -> T? where T: LosslessStringConvertible { if ProcessInfo.processInfo.arguments.contains("--io.sentry.schema-override-precedence") { - return ProcessInfo.processInfo.environment[key.rawValue].flatMap(T.init) + return ProcessInfo.processInfo.environment[key].flatMap(T.init) } - return defaults.object(forKey: key.rawValue) as? T - ?? ProcessInfo.processInfo.environment[key.rawValue].flatMap(T.init) + return defaults.object(forKey: key) as? T + ?? ProcessInfo.processInfo.environment[key].flatMap(T.init) } } diff --git a/Samples/iOS-Swift/iOS-Swift/SentrySDKWrapper.swift b/Samples/iOS-Swift/iOS-Swift/SentrySDKWrapper.swift index cf1119685d0..afbd76bd5a4 100644 --- a/Samples/iOS-Swift/iOS-Swift/SentrySDKWrapper.swift +++ b/Samples/iOS-Swift/iOS-Swift/SentrySDKWrapper.swift @@ -18,7 +18,7 @@ struct SentrySDKWrapper { options.beforeCaptureViewHierarchy = { _ in true } options.debug = true - if #available(iOS 16.0, *), enableSessionReplay { + if #available(iOS 16.0, *), SentrySDKOverrides.Other.disableSessionReplay.set { options.sessionReplay = SentryReplayOptions( sessionSampleRate: 0, onErrorSampleRate: 1, @@ -28,16 +28,16 @@ struct SentrySDKWrapper { options.sessionReplay.quality = .high } - if #available(iOS 15.0, *), enableMetricKit { + if #available(iOS 15.0, *), SentrySDKOverrides.Other.disableMetricKit.set { options.enableMetricKit = true options.enableMetricKitRawPayload = true } options.tracesSampleRate = 1 - if let sampleRate = SentrySDKOverrides.Tracing.sampleRate { + if let sampleRate = SentrySDKOverrides.Tracing.sampleRate.value { options.tracesSampleRate = NSNumber(value: sampleRate) } - if let samplerValue = SentrySDKOverrides.Tracing.samplerValue { + if let samplerValue = SentrySDKOverrides.Tracing.samplerValue.value { options.tracesSampler = { _ in return NSNumber(value: samplerValue) } @@ -45,33 +45,40 @@ struct SentrySDKWrapper { configureProfiling(options) - options.enableAutoSessionTracking = enableSessionTracking + options.enableAutoSessionTracking = SentrySDKOverrides.Performance.disableSessionTracking.set if let sessionTrackingIntervalMillis = env["--io.sentry.sessionTrackingIntervalMillis"] { options.sessionTrackingIntervalMillis = UInt((sessionTrackingIntervalMillis as NSString).integerValue) } options.add(inAppInclude: "iOS_External") - - options.enableUserInteractionTracing = enableUITracing - options.enableAppHangTracking = enableANRTracking - options.enableWatchdogTerminationTracking = enableWatchdogTracking - options.enableAutoPerformanceTracing = enablePerformanceTracing - options.enablePreWarmedAppStartTracing = enablePrewarmedAppStartTracing - options.enableFileIOTracing = enableFileIOTracing - options.enableAutoBreadcrumbTracking = enableBreadcrumbs - options.enableUIViewControllerTracing = enableUIVCTracing - options.enableNetworkTracking = enableNetworkTracing - options.enableCoreDataTracing = enableCoreDataTracing - options.enableNetworkBreadcrumbs = enableNetworkBreadcrumbs - options.enableSwizzling = enableSwizzling - options.enableCrashHandler = enableCrashHandling - options.enableTracing = enableTracing + + // the benchmark test starts and stops a custom transaction using a UIButton, and automatic user interaction tracing stops the transaction that begins with that button press after the idle timeout elapses, stopping the profiler (only one profiler runs regardless of the number of concurrent transactions) + options.enableUserInteractionTracing = !isBenchmarking && !SentrySDKOverrides.Performance.disableUITracing.set + + // disable during benchmarks because we run CPU for 15 seconds at full throttle which can trigger ANRs + options.enableAppHangTracking = !isBenchmarking && !SentrySDKOverrides.Performance.disableANRTracking.set + + // UI tests generate false OOMs + options.enableWatchdogTerminationTracking = !isBenchmarking && !SentrySDKOverrides.Performance.disableWatchdogTracking.set + + options.enableAutoPerformanceTracing = !isBenchmarking && !SentrySDKOverrides.Performance.disablePerformanceTracing.set + options.enablePreWarmedAppStartTracing = !isBenchmarking && !SentrySDKOverrides.Performance.disablePrewarmedAppStartTracing.set + options.enableTracing = !isBenchmarking && !SentrySDKOverrides.Tracing.disableTracing.set + + options.enableFileIOTracing = !SentrySDKOverrides.Performance.disableFileIOTracing.set + options.enableAutoBreadcrumbTracking = !SentrySDKOverrides.Other.disableBreadcrumbs.set + options.enableUIViewControllerTracing = !SentrySDKOverrides.Performance.disableUIVCTracing.set + options.enableNetworkTracking = !SentrySDKOverrides.Performance.disableNetworkTracing.set + options.enableCoreDataTracing = !SentrySDKOverrides.Performance.disableCoreDataTracing.set + options.enableNetworkBreadcrumbs = !SentrySDKOverrides.Other.disableNetworkBreadcrumbs.set + options.enableSwizzling = !SentrySDKOverrides.Other.disableSwizzling.set + options.enableCrashHandler = !SentrySDKOverrides.Other.disableCrashHandling.set options.enablePersistingTracesWhenCrashing = true - options.attachScreenshot = enableAttachScreenshot - options.attachViewHierarchy = enableAttachViewHierarchy - options.enableTimeToFullDisplayTracing = enableTimeToFullDisplayTracing - options.enablePerformanceV2 = enablePerformanceV2 - options.enableAppHangTrackingV2 = enableAppHangTrackingV2 + options.attachScreenshot = !SentrySDKOverrides.Other.disableAttachScreenshot.set + options.attachViewHierarchy = !SentrySDKOverrides.Other.disableAttachViewHierarchy.set + options.enableTimeToFullDisplayTracing = !SentrySDKOverrides.Performance.disableTimeToFullDisplayTracing.set + options.enablePerformanceV2 = !SentrySDKOverrides.Performance.disablePerformanceV2.set + options.enableAppHangTrackingV2 = !SentrySDKOverrides.Performance.disableAppHangTrackingV2.set options.failedRequestStatusCodes = [ HttpStatusCodeRange(min: 400, max: 599) ] options.beforeBreadcrumb = { breadcrumb in @@ -369,55 +376,26 @@ extension SentrySDKWrapper { false #endif // targetEnvironment(simulator) } - - /// - note: the benchmark test starts and stops a custom transaction using a UIButton, and automatic user interaction tracing stops the transaction that begins with that button press after the idle timeout elapses, stopping the profiler (only one profiler runs regardless of the number of concurrent transactions) - var enableUITracing: Bool { !isBenchmarking && !checkDisabled(with: "--disable-ui-tracing") } - var enablePrewarmedAppStartTracing: Bool { !isBenchmarking && !checkDisabled(with: "--disable-prewarmed-app-start-tracing") } - var enablePerformanceTracing: Bool { !isBenchmarking && !checkDisabled(with: "--disable-auto-performance-tracing") } - var enableTracing: Bool { !isBenchmarking && !checkDisabled(with: "--disable-tracing") } - /// - note: UI tests generate false OOMs - var enableWatchdogTracking: Bool { !isUITest && !isBenchmarking && !checkDisabled(with: "--disable-watchdog-tracking") } - /// - note: disable during benchmarks because we run CPU for 15 seconds at full throttle which can trigger ANRs - var enableANRTracking: Bool { !isBenchmarking && !checkDisabled(with: "--disable-anr-tracking") } - - // MARK: Other features - - var enableTimeToFullDisplayTracing: Bool { !checkDisabled(with: "--disable-time-to-full-display-tracing")} - var enableAttachScreenshot: Bool { !checkDisabled(with: "--disable-attach-screenshot")} - var enableAttachViewHierarchy: Bool { !checkDisabled(with: "--disable-attach-view-hierarchy")} - var enablePerformanceV2: Bool { !checkDisabled(with: "--disable-performance-v2")} - var enableAppHangTrackingV2: Bool { !checkDisabled(with: "--disable-app-hang-tracking-v2")} - var enableSessionReplay: Bool { !checkDisabled(with: "--disable-session-replay") } - var enableMetricKit: Bool { !checkDisabled(with: "--disable-metrickit-integration") } - var enableSessionTracking: Bool { !checkDisabled(with: "--disable-automatic-session-tracking") } - var enableFileIOTracing: Bool { !checkDisabled(with: "--disable-file-io-tracing") } - var enableBreadcrumbs: Bool { !checkDisabled(with: "--disable-automatic-breadcrumbs") } - var enableUIVCTracing: Bool { !checkDisabled(with: "--disable-uiviewcontroller-tracing") } - var enableNetworkTracing: Bool { !checkDisabled(with: "--disable-network-tracking") } - var enableCoreDataTracing: Bool { !checkDisabled(with: "--disable-core-data-tracing") } - var enableNetworkBreadcrumbs: Bool { !checkDisabled(with: "--disable-network-breadcrumbs") } - var enableSwizzling: Bool { !checkDisabled(with: "--disable-swizzling") } - var enableCrashHandling: Bool { !checkDisabled(with: "--disable-crash-handler") } } // MARK: Profiling configuration extension SentrySDKWrapper { func configureProfiling(_ options: Options) { - if let sampleRate = SentrySDKOverrides.Profiling.sampleRate { + if let sampleRate = SentrySDKOverrides.Profiling.sampleRate.value { options.profilesSampleRate = NSNumber(value: sampleRate) } - if let samplerValue = SentrySDKOverrides.Profiling.samplerValue { + if let samplerValue = SentrySDKOverrides.Profiling.samplerValue.value { options.profilesSampler = { _ in return NSNumber(value: samplerValue) } } - options.enableAppLaunchProfiling = SentrySDKOverrides.Profiling.profileAppStarts + options.enableAppLaunchProfiling = !SentrySDKOverrides.Profiling.disableAppStartProfiling.set - if !SentrySDKOverrides.Profiling.disableUIProfiling { + if !SentrySDKOverrides.Profiling.disableUIProfiling.set { options.configureProfiling = { - $0.lifecycle = SentrySDKOverrides.Profiling.manualLifecycle ? .manual : .trace - $0.sessionSampleRate = SentrySDKOverrides.Profiling.sessionSampleRate ?? 1 - $0.profileAppStarts = SentrySDKOverrides.Profiling.profileAppStarts + $0.lifecycle = SentrySDKOverrides.Profiling.manualLifecycle.set ? .manual : .trace + $0.sessionSampleRate = SentrySDKOverrides.Profiling.sessionSampleRate.value ?? 1 + $0.profileAppStarts = !SentrySDKOverrides.Profiling.disableAppStartProfiling.set } } } From 5cb431083aa2a7a30b88fae7d85db88520c184d8 Mon Sep 17 00:00:00 2001 From: Andrew McKnight Date: Wed, 9 Apr 2025 13:56:30 -0800 Subject: [PATCH 02/35] more wip --- .../iOS-Swift/SentrySDKOverrides.swift | 95 ++++++++++++------- .../iOS-Swift/SentrySDKWrapper.swift | 37 +++----- 2 files changed, 78 insertions(+), 54 deletions(-) diff --git a/Samples/iOS-Swift/iOS-Swift/SentrySDKOverrides.swift b/Samples/iOS-Swift/iOS-Swift/SentrySDKOverrides.swift index 01ff9f8116f..708056228dd 100644 --- a/Samples/iOS-Swift/iOS-Swift/SentrySDKOverrides.swift +++ b/Samples/iOS-Swift/iOS-Swift/SentrySDKOverrides.swift @@ -1,17 +1,45 @@ import Foundation -enum SentrySDKOverrides { - static let userDefaultOverrideSuffix = "-not-overridden" - static let defaults = UserDefaults.standard - - static func resetDefaults() { - for key in Tracing.allCases.map(\.rawValue) + Profiling.allCases.map(\.rawValue) { +public enum SentrySDKOverrides { + private static let userDefaultOverrideSuffix = "-not-overridden" + private static let defaults = UserDefaults.standard + + public static func resetDefaults() { + let allKeys = Tracing.allCases.map(\.rawValue) + + Profiling.allCases.map(\.rawValue) + + Performance.allCases.map(\.rawValue) + + Other.allCases.map(\.rawValue) + + Feedback.allCases.map(\.rawValue) + for key in allKeys { defaults.removeObject(forKey: key) defaults.set(true, forKey: key + userDefaultOverrideSuffix) } } - - enum Performance: String { + + enum Feedback: String, CaseIterable { + case allDefaults = "--io.sentry.feedback.all-defaults" + case disableAutoInject = "--io.sentry.feedback.no-auto-inject-widget" + case noWidgetText = "--io.sentry.feedback.no-widget-text" + case noWidgetIcon = "--io.sentry.feedback.no-widget-icon" + case noUserInjection = "--io.sentry.feedback.dont-use-sentry-user" + case requireEmail = "--io.sentry.feedback.require-email" + case requireName = "--io.sentry.feedback.require-name" + case noAnimations = "--io.sentry.feedback.no-animations" + + public var set: Bool { + get { + switch self { + case .disableAutoInject: getOverride(for: "--io.sentry.disable-everything") || getOverride(for: rawValue) + default: getOverride(for: rawValue) + } + } + set(newValue) { + setOverride(for: rawValue, value: newValue) + } + } + } + + enum Performance: String, CaseIterable { case disableTimeToFullDisplayTracing = "--disable-time-to-full-display-tracing" case disablePerformanceV2 = "--disable-performance-v2" case disableAppHangTrackingV2 = "--disable-app-hang-tracking-v2" @@ -26,17 +54,17 @@ enum SentrySDKOverrides { case disablePrewarmedAppStartTracing = "--disable-prewarmed-app-start-tracing" case disablePerformanceTracing = "--disable-auto-performance-tracing" - var set: Bool { + public var set: Bool { get { - getOverride(for: rawValue) + getOverride(for: "--io.sentry.disable-everything") || getOverride(for: rawValue) } set(newValue) { setOverride(for: rawValue, value: newValue) } } } - - enum Other: String { + + enum Other: String, CaseIterable { case disableAttachScreenshot = "--disable-attach-screenshot" case disableAttachViewHierarchy = "--disable-attach-view-hierarchy" case disableSessionReplay = "--disable-session-replay" @@ -47,26 +75,26 @@ enum SentrySDKOverrides { case disableCrashHandling = "--disable-crash-handler" case disableSpotlight = "--disable-spotlight" - var set: Bool { + public var set: Bool { get { - getOverride(for: rawValue) + getOverride(for: "--io.sentry.disable-everything") || getOverride(for: rawValue) } set(newValue) { setOverride(for: rawValue, value: newValue) } } } - - enum Tracing: String, CaseIterable { + + public enum Tracing: String, CaseIterable { case sampleRate = "--io.sentry.tracesSampleRate" case samplerValue = "--io.sentry.tracesSamplerValue" case disableTracing = "--io.sentry.disable-tracing" - var set: Bool { + public var set: Bool { get { switch self { case .sampleRate, .samplerValue: fatalError("Invalid") - default: getOverride(for: rawValue) + default: getOverride(for: "--io.sentry.disable-everything") || getOverride(for: rawValue) } } set(newValue) { @@ -77,7 +105,7 @@ enum SentrySDKOverrides { } } - var value: Float? { + public var value: Float? { get { switch self { case .disableTracing: fatalError("Invalid") @@ -92,8 +120,8 @@ enum SentrySDKOverrides { } } } - - enum Profiling: String, CaseIterable { + + public enum Profiling: String, CaseIterable { case sampleRate = "--io.sentry.profilesSampleRate" case samplerValue = "--io.sentry.profilesSamplerValue" case disableAppStartProfiling = "--io.sentry.disable-app-start-profiling" @@ -101,10 +129,11 @@ enum SentrySDKOverrides { case sessionSampleRate = "--io.sentry.profile-session-sample-rate" case disableUIProfiling = "--io.sentry.disable-ui-profiling" - var set: Bool { + public var set: Bool { get { switch self { case .sampleRate, .samplerValue, .sessionSampleRate: fatalError("Invalid") + case .disableUIProfiling, .disableAppStartProfiling: getOverride(for: "--io.sentry.disable-everything") || getOverride(for: rawValue) default: getOverride(for: rawValue) } } @@ -115,8 +144,8 @@ enum SentrySDKOverrides { } } } - - var value: Float? { + + public var value: Float? { get { switch self { case .disableUIProfiling, .disableAppStartProfiling, .manualLifecycle: fatalError("Invalid") @@ -131,7 +160,9 @@ enum SentrySDKOverrides { } } } - +} + +private extension SentrySDKOverrides { /// - note: This returns `false` in the default case. For anything that calls this method, design the API in such a way that by default it responds to this returning `false`, and then if it returns `true`, the override takes effect. Here's the decision tree: /// ``` /// - should schema overrides take precedence @@ -147,12 +178,12 @@ enum SentrySDKOverrides { /// - yes: return the value stored in user defaults /// - no: return false indicating that the override should not take effect /// ``` - private static func getOverride(for key: String) -> Bool { + static func getOverride(for key: String) -> Bool { let args = ProcessInfo.processInfo.arguments if args.contains("--io.sentry.schema-override-precedence") { guard args.contains(key) else { - return checkOverride(key) { + return checkDefaultsOverride(key) { false } } @@ -160,13 +191,13 @@ enum SentrySDKOverrides { return true } - return checkOverride(key) { + return checkDefaultsOverride(key) { args.contains(key) } } - + /// If a key is not present for a bool in user defaults, it returns false, but we need to know if it's returning false because it was overridden that way, or just isn't present, so we provide a way to return a "default value" if the override isn't present in defaults at all (indicated by a "true" value stored for "default X not overridden" key to make this truthy, otherwise return the stored defaults value - private static func checkOverride(_ key: String, defaultValue: () -> Bool) -> Bool { + static func checkDefaultsOverride(_ key: String, defaultValue: () -> Bool) -> Bool { let defaults = defaults guard !defaults.bool(forKey: key + userDefaultOverrideSuffix) else { @@ -176,12 +207,12 @@ enum SentrySDKOverrides { return defaults.bool(forKey: key) } - private static func setOverride(for key: String, value: Any?) { + static func setOverride(for key: String, value: Any?) { defaults.set(value, forKey: key) defaults.set(false, forKey: key + userDefaultOverrideSuffix) } - private static func getValueOverride(for key: String) -> T? where T: LosslessStringConvertible { + static func getValueOverride(for key: String) -> T? where T: LosslessStringConvertible { if ProcessInfo.processInfo.arguments.contains("--io.sentry.schema-override-precedence") { return ProcessInfo.processInfo.environment[key].flatMap(T.init) } diff --git a/Samples/iOS-Swift/iOS-Swift/SentrySDKWrapper.swift b/Samples/iOS-Swift/iOS-Swift/SentrySDKWrapper.swift index afbd76bd5a4..6e62be139ee 100644 --- a/Samples/iOS-Swift/iOS-Swift/SentrySDKWrapper.swift +++ b/Samples/iOS-Swift/iOS-Swift/SentrySDKWrapper.swift @@ -59,7 +59,7 @@ struct SentrySDKWrapper { options.enableAppHangTracking = !isBenchmarking && !SentrySDKOverrides.Performance.disableANRTracking.set // UI tests generate false OOMs - options.enableWatchdogTerminationTracking = !isBenchmarking && !SentrySDKOverrides.Performance.disableWatchdogTracking.set + options.enableWatchdogTerminationTracking = !isUITest && !isBenchmarking && !SentrySDKOverrides.Performance.disableWatchdogTracking.set options.enableAutoPerformanceTracing = !isBenchmarking && !SentrySDKOverrides.Performance.disablePerformanceTracing.set options.enablePreWarmedAppStartTracing = !isBenchmarking && !SentrySDKOverrides.Performance.disablePrewarmedAppStartTracing.set @@ -80,7 +80,13 @@ struct SentrySDKWrapper { options.enablePerformanceV2 = !SentrySDKOverrides.Performance.disablePerformanceV2.set options.enableAppHangTrackingV2 = !SentrySDKOverrides.Performance.disableAppHangTrackingV2.set options.failedRequestStatusCodes = [ HttpStatusCodeRange(min: 400, max: 599) ] - + + #if targetEnvironment(simulator) + options.enableSpotlight = !SentrySDKOverrides.Other.disableSpotlight.set + #else + options.enableSpotlight = false + #endif // targetEnvironment(simulator) + options.beforeBreadcrumb = { breadcrumb in //Raising notifications when a new breadcrumb is created in order to use this information //to validate whether proper breadcrumb are being created in the right places. @@ -152,7 +158,7 @@ extension SentrySDKWrapper { var layoutOffset: UIOffset { UIOffset(horizontal: 25, vertical: 75) } func configureFeedbackWidget(config: SentryUserFeedbackWidgetConfiguration) { - guard !args.contains("--io.sentry.feedback.no-auto-inject-widget") else { + guard !SentrySDKOverrides.Feedback.disableAutoInject.set else { config.autoInject = false return } @@ -170,19 +176,19 @@ extension SentrySDKWrapper { } config.layoutUIOffset = layoutOffset - if args.contains("--io.sentry.feedback.no-widget-text") { + if SentrySDKOverrides.Feedback.noWidgetText.set { config.labelText = nil } - if args.contains("--io.sentry.feedback.no-widget-icon") { + if SentrySDKOverrides.Feedback.noWidgetIcon.set { config.showIcon = false } } func configureFeedbackForm(config: SentryUserFeedbackFormConfiguration) { - config.useSentryUser = !args.contains("--io.sentry.feedback.dont-use-sentry-user") + config.useSentryUser = !SentrySDKOverrides.Feedback.noUserInjection.set config.formTitle = "Jank Report" - config.isEmailRequired = args.contains("--io.sentry.feedback.require-email") - config.isNameRequired = args.contains("--io.sentry.feedback.require-name") + config.isEmailRequired = SentrySDKOverrides.Feedback.requireEmail.set + config.isNameRequired = SentrySDKOverrides.Feedback.requireName.set config.submitButtonLabel = "Report that jank" config.removeScreenshotButtonLabel = "Oof too nsfl" config.cancelButtonLabel = "What, me worry?" @@ -226,7 +232,7 @@ extension SentrySDKWrapper { return } - config.animations = !args.contains("--io.sentry.feedback.no-animations") + config.animations = !SentrySDKOverrides.Feedback.noAnimations.set config.useShakeGesture = true config.showFormForScreenshots = true config.configureWidget = configureFeedbackWidget(config:) @@ -363,19 +369,6 @@ extension SentrySDKWrapper { /// Whether or not profiling benchmarks are being run; this requires disabling certain other features for proper functionality. var isBenchmarking: Bool { args.contains("--io.sentry.test.benchmarking") } var isUITest: Bool { env["--io.sentry.sdk-environment"] == "ui-tests" } - - func checkDisabled(with arg: String) -> Bool { - args.contains("--io.sentry.disable-everything") || args.contains(arg) - } - - // MARK: features that care about simulator vs device, ui tests and profiling benchmarks - var enableSpotlight: Bool { -#if targetEnvironment(simulator) - !checkDisabled(with: "--disable-spotlight") -#else - false -#endif // targetEnvironment(simulator) - } } // MARK: Profiling configuration From 968a0669f8e82da4950cef3086d2e80419479cf2 Mon Sep 17 00:00:00 2001 From: Andrew McKnight Date: Wed, 9 Apr 2025 15:47:40 -0800 Subject: [PATCH 03/35] implement display --- .../iOS-Swift.xcodeproj/project.pbxproj | 18 +++ .../xcshareddata/xcschemes/iOS-Swift.xcscheme | 10 +- .../iOS-Swift/Base.lproj/Main.storyboard | 27 ++-- .../EnvironmentVariableTableViewCell.swift | 42 +++++ .../Extensions/UIViewExtension.swift | 4 +- .../iOS-Swift/FeaturesViewController.swift | 110 +++++++++++++ .../LaunchArgumentTableViewCell.swift | 33 ++++ .../iOS-Swift/SentrySDKOverrides.swift | 150 ++++++++++-------- .../Sentry/Profiling/SentryLaunchProfiling.m | 11 ++ develop-docs/README.md | 10 +- 10 files changed, 331 insertions(+), 84 deletions(-) create mode 100644 Samples/iOS-Swift/iOS-Swift/EnvironmentVariableTableViewCell.swift create mode 100644 Samples/iOS-Swift/iOS-Swift/FeaturesViewController.swift create mode 100644 Samples/iOS-Swift/iOS-Swift/LaunchArgumentTableViewCell.swift diff --git a/Samples/iOS-Swift/iOS-Swift.xcodeproj/project.pbxproj b/Samples/iOS-Swift/iOS-Swift.xcodeproj/project.pbxproj index fba8e0cb3f4..d53ec1d7c95 100644 --- a/Samples/iOS-Swift/iOS-Swift.xcodeproj/project.pbxproj +++ b/Samples/iOS-Swift/iOS-Swift.xcodeproj/project.pbxproj @@ -26,6 +26,12 @@ 840DDB2A2D9EFD49000C17F7 /* BenchmarkingViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 840DDB292D9EFD49000C17F7 /* BenchmarkingViewController.swift */; }; 840DDB2C2D9F02CB000C17F7 /* SentrySDKOverrides.swift in Sources */ = {isa = PBXBuildFile; fileRef = 840DDB2B2D9F02CB000C17F7 /* SentrySDKOverrides.swift */; }; 840DDB2D2D9F02CB000C17F7 /* SentrySDKOverrides.swift in Sources */ = {isa = PBXBuildFile; fileRef = 840DDB2B2D9F02CB000C17F7 /* SentrySDKOverrides.swift */; }; + 841C8A202DA7266E00DCA74F /* FeaturesViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 841C8A1F2DA7266E00DCA74F /* FeaturesViewController.swift */; }; + 841C8A212DA7266E00DCA74F /* FeaturesViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 841C8A1F2DA7266E00DCA74F /* FeaturesViewController.swift */; }; + 841C8A232DA7273400DCA74F /* LaunchArgumentTableViewCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 841C8A222DA7273400DCA74F /* LaunchArgumentTableViewCell.swift */; }; + 841C8A242DA7273400DCA74F /* LaunchArgumentTableViewCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 841C8A222DA7273400DCA74F /* LaunchArgumentTableViewCell.swift */; }; + 841C8A262DA7273E00DCA74F /* EnvironmentVariableTableViewCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 841C8A252DA7273E00DCA74F /* EnvironmentVariableTableViewCell.swift */; }; + 841C8A272DA7273E00DCA74F /* EnvironmentVariableTableViewCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 841C8A252DA7273E00DCA74F /* EnvironmentVariableTableViewCell.swift */; }; 844DA821282584C300E6B62E /* CoreDataViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = D8F57BC427BBD787000D09D4 /* CoreDataViewController.swift */; }; 844DA822282584F700E6B62E /* SentryData.xcdatamodeld in Sources */ = {isa = PBXBuildFile; fileRef = D845F35927BAD4CC00A4D7A2 /* SentryData.xcdatamodeld */; }; 847670302BAA4AFA001A4E31 /* NSObject+SentryAppSetup.m in Sources */ = {isa = PBXBuildFile; fileRef = 8476702F2BAA4AFA001A4E31 /* NSObject+SentryAppSetup.m */; }; @@ -279,6 +285,9 @@ 7BFC8B0526D4D24B000D3504 /* LoremIpsum.txt */ = {isa = PBXFileReference; lastKnownFileType = text; path = LoremIpsum.txt; sourceTree = ""; }; 840DDB292D9EFD49000C17F7 /* BenchmarkingViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = BenchmarkingViewController.swift; sourceTree = ""; }; 840DDB2B2D9F02CB000C17F7 /* SentrySDKOverrides.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SentrySDKOverrides.swift; sourceTree = ""; }; + 841C8A1F2DA7266E00DCA74F /* FeaturesViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = FeaturesViewController.swift; sourceTree = ""; }; + 841C8A222DA7273400DCA74F /* LaunchArgumentTableViewCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LaunchArgumentTableViewCell.swift; sourceTree = ""; }; + 841C8A252DA7273E00DCA74F /* EnvironmentVariableTableViewCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = EnvironmentVariableTableViewCell.swift; sourceTree = ""; }; 8476702E2BAA4AFA001A4E31 /* NSObject+SentryAppSetup.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "NSObject+SentryAppSetup.h"; sourceTree = ""; }; 8476702F2BAA4AFA001A4E31 /* NSObject+SentryAppSetup.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = "NSObject+SentryAppSetup.m"; sourceTree = ""; }; 848A2573286E3351008A8858 /* PerformanceBenchmarks.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = PerformanceBenchmarks.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; @@ -506,6 +515,9 @@ 637AFDB7243B02770034958B /* Info.plist */, D845F35927BAD4CC00A4D7A2 /* SentryData.xcdatamodeld */, D8BCCDE12CAFDE9400E8A030 /* Sample.xcconfig */, + 841C8A1F2DA7266E00DCA74F /* FeaturesViewController.swift */, + 841C8A222DA7273400DCA74F /* LaunchArgumentTableViewCell.swift */, + 841C8A252DA7273E00DCA74F /* EnvironmentVariableTableViewCell.swift */, ); path = "iOS-Swift"; sourceTree = ""; @@ -1135,6 +1147,7 @@ D8DBDA76274D591F00007380 /* TableViewController.swift in Sources */, D8C33E1F29FBB1F70071B75A /* UIEventBreadcrumbsController.swift in Sources */, 8E8C57AF25EF16E6001CEEFA /* TraceTestViewController.swift in Sources */, + 841C8A202DA7266E00DCA74F /* FeaturesViewController.swift in Sources */, 84AB90712A5001000054C99A /* ProfilingViewController.swift in Sources */, 840DDB2A2D9EFD49000C17F7 /* BenchmarkingViewController.swift in Sources */, 84FB812A284001B800F3A94A /* SentryBenchmarking.mm in Sources */, @@ -1142,6 +1155,7 @@ 847670302BAA4AFA001A4E31 /* NSObject+SentryAppSetup.m in Sources */, D8F3D052274E572F00B56F8C /* DSNStorage.swift in Sources */, D8F3D054274E572F00B56F8C /* RandomErrors.swift in Sources */, + 841C8A232DA7273400DCA74F /* LaunchArgumentTableViewCell.swift in Sources */, D80D021329EE93630084393D /* ErrorsViewController.swift in Sources */, D8D7BB4C2750095800044146 /* UIViewExtension.swift in Sources */, 7B79000429028C7300A7F467 /* MetricKitManager.swift in Sources */, @@ -1151,6 +1165,7 @@ 629EC8AD2B0B537400858855 /* TriggerAppHang.swift in Sources */, D8AE48C92C57DC2F0092A2A6 /* WebViewController.swift in Sources */, 84EEE6632D28B35700010A9D /* SentrySDKWrapper.swift in Sources */, + 841C8A272DA7273E00DCA74F /* EnvironmentVariableTableViewCell.swift in Sources */, D8DBDA78274D5FC400007380 /* SplitViewController.swift in Sources */, 84ACC43C2A73CB5900932A18 /* ProfilingNetworkScanner.swift in Sources */, D80D021A29EE936F0084393D /* ExtraViewController.swift in Sources */, @@ -1187,8 +1202,10 @@ isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; files = ( + 841C8A212DA7266E00DCA74F /* FeaturesViewController.swift in Sources */, D8BC843E2B021C5200A662B7 /* SwiftUIView.swift in Sources */, D8832B1A2AF5000F00C522B0 /* TopViewControllerInspector.swift in Sources */, + 841C8A242DA7273400DCA74F /* LaunchArgumentTableViewCell.swift in Sources */, D8AE48CF2C57E0BD0092A2A6 /* WebViewController.swift in Sources */, 84BA71F22C8F73FD0045B828 /* DSNDisplayViewController.swift in Sources */, D8444E56275F79590042F4DE /* UIViewExtension.swift in Sources */, @@ -1215,6 +1232,7 @@ D8269A3C274C095E00BD5BD5 /* AppDelegate.swift in Sources */, 629EC8BB2B0B5BAE00858855 /* TriggerAppHang.swift in Sources */, D80D021B29EE9E3D0084393D /* ErrorsViewController.swift in Sources */, + 841C8A262DA7273E00DCA74F /* EnvironmentVariableTableViewCell.swift in Sources */, D8444E53275F792A0042F4DE /* UIAssert.swift in Sources */, D8269A3E274C095E00BD5BD5 /* SceneDelegate.swift in Sources */, D8444E54275F794D0042F4DE /* SpanObserver.swift in Sources */, diff --git a/Samples/iOS-Swift/iOS-Swift.xcodeproj/xcshareddata/xcschemes/iOS-Swift.xcscheme b/Samples/iOS-Swift/iOS-Swift.xcodeproj/xcshareddata/xcschemes/iOS-Swift.xcscheme index 9e1a7637085..01bdc9d9ae5 100644 --- a/Samples/iOS-Swift/iOS-Swift.xcodeproj/xcshareddata/xcschemes/iOS-Swift.xcscheme +++ b/Samples/iOS-Swift/iOS-Swift.xcodeproj/xcshareddata/xcschemes/iOS-Swift.xcscheme @@ -89,8 +89,8 @@ isEnabled = "NO"> + argument = "--io.sentry.schema-environment-variable-precedence" + isEnabled = "YES"> + isEnabled = "YES"> + value = "0.5" + isEnabled = "YES"> - + - - + + - - - - - + + + + + + + + - + @@ -899,7 +902,7 @@ - + @@ -1592,13 +1595,13 @@ - + - + diff --git a/Samples/iOS-Swift/iOS-Swift/EnvironmentVariableTableViewCell.swift b/Samples/iOS-Swift/iOS-Swift/EnvironmentVariableTableViewCell.swift new file mode 100644 index 00000000000..a0a6d464464 --- /dev/null +++ b/Samples/iOS-Swift/iOS-Swift/EnvironmentVariableTableViewCell.swift @@ -0,0 +1,42 @@ +import UIKit + +class EnvironmentVariableTableViewCell: UITableViewCell, UITextFieldDelegate { + let titleLabel = UILabel(frame: .zero) + lazy var valueField = { + let field = UITextField(frame: .zero) + field.delegate = self + return field + }() + var override: (any SentrySDKOverride)? + + override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) { + super.init(style: style, reuseIdentifier: reuseIdentifier) + let stack = UIStackView(arrangedSubviews: [valueField, titleLabel]) + stack.spacing = 8 + contentView.addSubview(stack) + stack.matchEdgeAnchors(from: contentView, topPad: 8, bottomPad: 8) + + valueField.borderStyle = .roundedRect + } + + required init?(coder: NSCoder) { + fatalError("init(coder:) has not been implemented") + } + + func configure(with launchArgument: any SentrySDKOverride) { + titleLabel.text = launchArgument.rawValue as? String + + var text: String + if let value = launchArgument.value { + text = String(format: "%.2f", value) + } else { + text = "nil" + } + valueField.text = text + self.override = launchArgument + } + + func textFieldDidEndEditing(_ textField: UITextField) { + override?.value = textField.text.flatMap { Float($0) } + } +} diff --git a/Samples/iOS-Swift/iOS-Swift/Extensions/UIViewExtension.swift b/Samples/iOS-Swift/iOS-Swift/Extensions/UIViewExtension.swift index e69767b947e..9124dd3cca5 100644 --- a/Samples/iOS-Swift/iOS-Swift/Extensions/UIViewExtension.swift +++ b/Samples/iOS-Swift/iOS-Swift/Extensions/UIViewExtension.swift @@ -14,9 +14,9 @@ extension UIView { other.translatesAutoresizingMaskIntoConstraints = false NSLayoutConstraint.activate([ leadingAnchor.constraint(equalTo: other.leadingAnchor, constant: leadingPad), - trailingAnchor.constraint(equalTo: other.trailingAnchor, constant: trailingPad), + trailingAnchor.constraint(equalTo: other.trailingAnchor, constant: -trailingPad), topAnchor.constraint(equalTo: other.topAnchor, constant: topPad), - bottomAnchor.constraint(equalTo: other.bottomAnchor, constant: bottomPad) + bottomAnchor.constraint(equalTo: other.bottomAnchor, constant: -bottomPad) ]) } } diff --git a/Samples/iOS-Swift/iOS-Swift/FeaturesViewController.swift b/Samples/iOS-Swift/iOS-Swift/FeaturesViewController.swift new file mode 100644 index 00000000000..0579e742ac4 --- /dev/null +++ b/Samples/iOS-Swift/iOS-Swift/FeaturesViewController.swift @@ -0,0 +1,110 @@ +import UIKit + +class FeaturesViewController: UITableViewController { + override func viewDidLoad() { + super.viewDidLoad() + tableView.register(LaunchArgumentTableViewCell.self, forCellReuseIdentifier: "launchArgumentCell") + tableView.register(EnvironmentVariableTableViewCell.self, forCellReuseIdentifier: "environmentVariableCell") + tableView.tableHeaderView = tableHeader + } + + var tableHeader: UIView { + let resetButton = UIButton(type: .custom) + resetButton.setTitle("Reset Defaults", for: .normal) + resetButton.setTitleColor(.blue, for: .normal) + resetButton.addTarget(self, action: #selector(resetDefaults), for: .touchUpInside) + + let label = UILabel(frame: .zero) + label.text = SentrySDKOverrides.schemaPrecedenceForEnvironmentVariables ? "Schema Precedence" : "Defaults Precedence" + + let stack = UIStackView(arrangedSubviews: [label, resetButton]) + stack.spacing = 8 + + let header = UIView(frame: .zero) + header.addSubview(stack) + + stack.matchEdgeAnchors(from: header) + header.heightAnchor.constraint(equalToConstant: 50).isActive = true + + return header + } + + @objc func resetDefaults() { + SentrySDKOverrides.resetDefaults() + tableView.reloadData() + } + + override func numberOfSections(in tableView: UITableView) -> Int { + 6 + } + + override func tableView(_ tableView: UITableView, titleForHeaderInSection section: Int) -> String? { + if section == 0 { + return "Special" + } else if section == 1 { + return "Performance" + } else if section == 2 { + return "Tracing" + } else if section == 3 { + return "Profiling" + } else if section == 4 { + return "Feedback" + } else if section == 5 { + return "Other" + } + return nil + } + + override func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int { + if section == 0 { + return SentrySDKOverrides.Special.allCases.count + } else if section == 1 { + return SentrySDKOverrides.Performance.allCases.count + } else if section == 2 { + return SentrySDKOverrides.Tracing.allCases.count + } else if section == 3 { + return SentrySDKOverrides.Profiling.allCases.count + } else if section == 4 { + return SentrySDKOverrides.Feedback.allCases.count + } else if section == 5 { + return SentrySDKOverrides.Other.allCases.count + } + return 0 + } + + override func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell { + if indexPath.section == 2 { + if SentrySDKOverrides.Tracing.args.contains(SentrySDKOverrides.Tracing.allCases[indexPath.row]) { + let cell = tableView.dequeueReusableCell(withIdentifier: "launchArgumentCell", for: indexPath) as! LaunchArgumentTableViewCell + cell.configure(with: SentrySDKOverrides.Tracing.allCases[indexPath.row]) + return cell + } else { + let cell = tableView.dequeueReusableCell(withIdentifier: "environmentVariableCell", for: indexPath) as! EnvironmentVariableTableViewCell + cell.configure(with: SentrySDKOverrides.Tracing.allCases[indexPath.row]) + return cell + } + } else if indexPath.section == 3 { + if SentrySDKOverrides.Profiling.args.contains(SentrySDKOverrides.Profiling.allCases[indexPath.row]) { + let cell = tableView.dequeueReusableCell(withIdentifier: "launchArgumentCell", for: indexPath) as! LaunchArgumentTableViewCell + cell.configure(with: SentrySDKOverrides.Profiling.allCases[indexPath.row]) + return cell + } else { + let cell = tableView.dequeueReusableCell(withIdentifier: "environmentVariableCell", for: indexPath) as! EnvironmentVariableTableViewCell + cell.configure(with: SentrySDKOverrides.Profiling.allCases[indexPath.row]) + return cell + } + } + + let cell = tableView.dequeueReusableCell(withIdentifier: "launchArgumentCell", for: indexPath) as! LaunchArgumentTableViewCell + if indexPath.section == 0 { + cell.configure(with: SentrySDKOverrides.Special.allCases[indexPath.row]) + } else if indexPath.section == 1 { + cell.configure(with: SentrySDKOverrides.Performance.allCases[indexPath.row]) + } else if indexPath.section == 4 { + cell.configure(with: SentrySDKOverrides.Feedback.allCases[indexPath.row]) + } else if indexPath.section == 5 { + cell.configure(with: SentrySDKOverrides.Other.allCases[indexPath.row]) + } + return cell + } +} diff --git a/Samples/iOS-Swift/iOS-Swift/LaunchArgumentTableViewCell.swift b/Samples/iOS-Swift/iOS-Swift/LaunchArgumentTableViewCell.swift new file mode 100644 index 00000000000..4c63d17e897 --- /dev/null +++ b/Samples/iOS-Swift/iOS-Swift/LaunchArgumentTableViewCell.swift @@ -0,0 +1,33 @@ +import UIKit + +class LaunchArgumentTableViewCell: UITableViewCell { + let titleLabel = UILabel(frame: .zero) + lazy var flagSwitch = { + let flagSwitch = UISwitch(frame: .zero) + flagSwitch.addTarget(self, action: #selector(toggleFlag), for: .valueChanged) + return flagSwitch + }() + var override: (any SentrySDKOverride)? + + @objc func toggleFlag() { + override?.set = flagSwitch.isOn + } + + override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) { + super.init(style: style, reuseIdentifier: reuseIdentifier) + let stack = UIStackView(arrangedSubviews: [flagSwitch, titleLabel]) + stack.spacing = 8 + contentView.addSubview(stack) + stack.matchEdgeAnchors(from: contentView, topPad: 8, bottomPad: 8) + } + + required init?(coder: NSCoder) { + fatalError("init(coder:) has not been implemented") + } + + func configure(with launchArgument: any SentrySDKOverride) { + titleLabel.text = launchArgument.rawValue as? String + flagSwitch.isOn = launchArgument.set + self.override = launchArgument + } +} diff --git a/Samples/iOS-Swift/iOS-Swift/SentrySDKOverrides.swift b/Samples/iOS-Swift/iOS-Swift/SentrySDKOverrides.swift index 708056228dd..56a8b7aa7a0 100644 --- a/Samples/iOS-Swift/iOS-Swift/SentrySDKOverrides.swift +++ b/Samples/iOS-Swift/iOS-Swift/SentrySDKOverrides.swift @@ -1,9 +1,17 @@ import Foundation +protocol SentrySDKOverride: RawRepresentable, CaseIterable { + var set: Bool { get set } + var value: Float? { get set } +} + public enum SentrySDKOverrides { - private static let userDefaultOverrideSuffix = "-not-overridden" private static let defaults = UserDefaults.standard + public static var schemaPrecedenceForEnvironmentVariables: Bool { + ProcessInfo.processInfo.arguments.contains("--io.sentry.schema-environment-variable-precedence") + } + public static func resetDefaults() { let allKeys = Tracing.allCases.map(\.rawValue) + Profiling.allCases.map(\.rawValue) @@ -12,11 +20,33 @@ public enum SentrySDKOverrides { + Feedback.allCases.map(\.rawValue) for key in allKeys { defaults.removeObject(forKey: key) - defaults.set(true, forKey: key + userDefaultOverrideSuffix) } } - enum Feedback: String, CaseIterable { + enum Special: String, SentrySDKOverride { + case wipeDataOnLaunch = "--io.sentry.wipe-data" + case disableEverything = "--io.sentry.disable-everything" + + public var set: Bool { + get { + getOverride(for: rawValue) + } + set(newValue) { + setUserDefaultOverride(for: rawValue, value: newValue) + } + } + + var value: Float? { + get { + fatalError("Invalid") + } + set(newValue) { + fatalError("Invalid") + } + } + } + + enum Feedback: String, SentrySDKOverride { case allDefaults = "--io.sentry.feedback.all-defaults" case disableAutoInject = "--io.sentry.feedback.no-auto-inject-widget" case noWidgetText = "--io.sentry.feedback.no-widget-text" @@ -34,12 +64,21 @@ public enum SentrySDKOverrides { } } set(newValue) { - setOverride(for: rawValue, value: newValue) + setUserDefaultOverride(for: rawValue, value: newValue) + } + } + + var value: Float? { + get { + fatalError("Invalid") + } + set(newValue) { + fatalError("Invalid") } } } - enum Performance: String, CaseIterable { + enum Performance: String, SentrySDKOverride { case disableTimeToFullDisplayTracing = "--disable-time-to-full-display-tracing" case disablePerformanceV2 = "--disable-performance-v2" case disableAppHangTrackingV2 = "--disable-app-hang-tracking-v2" @@ -59,12 +98,21 @@ public enum SentrySDKOverrides { getOverride(for: "--io.sentry.disable-everything") || getOverride(for: rawValue) } set(newValue) { - setOverride(for: rawValue, value: newValue) + setUserDefaultOverride(for: rawValue, value: newValue) + } + } + + var value: Float? { + get { + fatalError("Invalid") + } + set(newValue) { + fatalError("Invalid") } } } - enum Other: String, CaseIterable { + enum Other: String, SentrySDKOverride { case disableAttachScreenshot = "--disable-attach-screenshot" case disableAttachViewHierarchy = "--disable-attach-view-hierarchy" case disableSessionReplay = "--disable-session-replay" @@ -80,12 +128,21 @@ public enum SentrySDKOverrides { getOverride(for: "--io.sentry.disable-everything") || getOverride(for: rawValue) } set(newValue) { - setOverride(for: rawValue, value: newValue) + setUserDefaultOverride(for: rawValue, value: newValue) + } + } + + var value: Float? { + get { + fatalError("Invalid") + } + set(newValue) { + fatalError("Invalid") } } } - public enum Tracing: String, CaseIterable { + public enum Tracing: String, SentrySDKOverride { case sampleRate = "--io.sentry.tracesSampleRate" case samplerValue = "--io.sentry.tracesSamplerValue" case disableTracing = "--io.sentry.disable-tracing" @@ -100,7 +157,7 @@ public enum SentrySDKOverrides { set(newValue) { switch self { case .sampleRate, .samplerValue: fatalError("Invalid") - default: setOverride(for: rawValue, value: newValue) + default: setUserDefaultOverride(for: rawValue, value: newValue) } } } @@ -115,13 +172,16 @@ public enum SentrySDKOverrides { set(newValue) { switch self { case .disableTracing: fatalError("Invalid") - default: setOverride(for: rawValue, value: newValue) + default: setUserDefaultOverride(for: rawValue, value: newValue) } } } + + public static var args: [Tracing] { [.disableTracing] } + public static var vars: [Tracing] { [.sampleRate, .samplerValue] } } - public enum Profiling: String, CaseIterable { + public enum Profiling: String, SentrySDKOverride { case sampleRate = "--io.sentry.profilesSampleRate" case samplerValue = "--io.sentry.profilesSamplerValue" case disableAppStartProfiling = "--io.sentry.disable-app-start-profiling" @@ -140,7 +200,7 @@ public enum SentrySDKOverrides { set(newValue) { switch self { case .sampleRate, .samplerValue, .sessionSampleRate: fatalError("Invalid") - default: setOverride(for: rawValue, value: newValue) + default: setUserDefaultOverride(for: rawValue, value: newValue) } } } @@ -155,69 +215,35 @@ public enum SentrySDKOverrides { set(newValue) { switch self { case .disableUIProfiling, .disableAppStartProfiling, .manualLifecycle: fatalError("Invalid") - default: setOverride(for: rawValue, value: newValue) + default: setUserDefaultOverride(for: rawValue, value: newValue) } } } + + public static var args: [Profiling] { [.disableUIProfiling, .disableAppStartProfiling, .manualLifecycle] } + public static var vars: [Profiling] { [.sampleRate, .samplerValue, .sessionSampleRate] } } } private extension SentrySDKOverrides { - /// - note: This returns `false` in the default case. For anything that calls this method, design the API in such a way that by default it responds to this returning `false`, and then if it returns `true`, the override takes effect. Here's the decision tree: - /// ``` - /// - should schema overrides take precedence - /// - no (default) - /// - is override present in user defaults - /// - yes: return the value stored in user defaults - /// - no: return whether override flag is set in schema - /// - yes - /// - is override flag in the schema - /// - yes: return true indicating the override should take effect - /// - no - /// - is override present in user defaults - /// - yes: return the value stored in user defaults - /// - no: return false indicating that the override should not take effect - /// ``` static func getOverride(for key: String) -> Bool { - let args = ProcessInfo.processInfo.arguments - - if args.contains("--io.sentry.schema-override-precedence") { - guard args.contains(key) else { - return checkDefaultsOverride(key) { - false - } - } - - return true - } - - return checkDefaultsOverride(key) { - args.contains(key) - } - } - - /// If a key is not present for a bool in user defaults, it returns false, but we need to know if it's returning false because it was overridden that way, or just isn't present, so we provide a way to return a "default value" if the override isn't present in defaults at all (indicated by a "true" value stored for "default X not overridden" key to make this truthy, otherwise return the stored defaults value - static func checkDefaultsOverride(_ key: String, defaultValue: () -> Bool) -> Bool { - let defaults = defaults - - guard !defaults.bool(forKey: key + userDefaultOverrideSuffix) else { - return defaultValue() - } - - return defaults.bool(forKey: key) + ProcessInfo.processInfo.arguments.contains(key) || defaults.bool(forKey: key) } - static func setOverride(for key: String, value: Any?) { + static func setUserDefaultOverride(for key: String, value: Any?) { defaults.set(value, forKey: key) - defaults.set(false, forKey: key + userDefaultOverrideSuffix) } static func getValueOverride(for key: String) -> T? where T: LosslessStringConvertible { - if ProcessInfo.processInfo.arguments.contains("--io.sentry.schema-override-precedence") { - return ProcessInfo.processInfo.environment[key].flatMap(T.init) + var schemaEnvironmentVariable: T? + if let value = ProcessInfo.processInfo.environment[key] { + schemaEnvironmentVariable = value as? T + } + let defaultsValue = defaults.object(forKey: key) as? T + if schemaPrecedenceForEnvironmentVariables { + return schemaEnvironmentVariable ?? defaultsValue + } else { + return defaultsValue ?? schemaEnvironmentVariable } - - return defaults.object(forKey: key) as? T - ?? ProcessInfo.processInfo.environment[key].flatMap(T.init) } } diff --git a/Sources/Sentry/Profiling/SentryLaunchProfiling.m b/Sources/Sentry/Profiling/SentryLaunchProfiling.m index fbc397e0a9d..825c82622bb 100644 --- a/Sources/Sentry/Profiling/SentryLaunchProfiling.m +++ b/Sources/Sentry/Profiling/SentryLaunchProfiling.m @@ -385,6 +385,17 @@ void sentry_stopAndDiscardLaunchProfileTracer(void) { + if (sentry_launchTracer == nil) { + if (sentry_isTracingAppLaunch) { + SENTRY_LOG_WARN(@"Inconsistent state detected for app launch tracking."); + } + return; + } + + if (!sentry_isTracingAppLaunch) { + SENTRY_LOG_WARN(@"Inconsistent state detected for app launch tracking."); + } + SENTRY_LOG_DEBUG(@"Finishing launch tracer."); [sentry_launchTracer finish]; sentry_isTracingAppLaunch = NO; diff --git a/develop-docs/README.md b/develop-docs/README.md index 8f22d920f75..062384d9610 100644 --- a/develop-docs/README.md +++ b/develop-docs/README.md @@ -193,13 +193,17 @@ With continuous profiling, there's also only ever one profiler instance running Also referred to in implementation as continuous profiling V2. Essentially a combination of transaction-based profiling (although now focused on "root spans" instead of transactions) for the trace lifecycle and continuous profiling beta for the manual lifecycle, with the exception that manual mode also respects a configured sample rate. +The sample apps are configured by default to use UI Profiling with trace lifecycle (to override the default of manual lifecycle), traces and profile session sample rates of 1 (to override the defaults of 0), and to use app start profiling. + ### Sample apps -The iOS-Swift and iOS-ObjectiveC sample apps have several launch args to switch between the different modes. +The iOS-Swift and iOS-ObjectiveC sample apps have schema launch args and environment variables available to customize how the SDK is configured. + +In iOS-Swift, these can also be modified at runtime, to help test various configurations in scenarios where using launch args and environment variables isn't possible, like TestFlight builds. Runtime overrides are set via `UserDefaults`. They interact with schema launch arguments and environment variables as follows: - Boolean flags are ORed together: if either a `true` is set in User Defaults, or a launch argument is set, then the override takes effect. - Values written to user defaults take precedence over schema environment variables by default. If you want to give precedence to schema environment vars over user defaults values, enable the launch arg `--io.sentry.schema-environment-variable-precedence`. -By default, the launch arguments for the iOS-Swift and iOS-ObjectiveC schemas are configured to use UI Profiling with trace lifecycle (to override the default of manual lifecycle), traces and profile session sample rates of 1 (to override the defaults of 0), and to use app start profiling. +You can see the current override value being used in the "Features" tab. -In iOS-Swift, these can also be modified at runtime, to help test various configurations in scenarios where using launch args and environment variables isn't possible, like TestFlight builds. Runtime overrides are set via `UserDefaults` and by default take precedence over launch arg and env variable settings when both are present. If you want to give precedence to schema launch args and environment vars over user defaults values, enable the launch arg `--io.sentry.schema-override-precedence`. You can also remove all stored values in user defaults by launching with `--io.sentry.wipe-data`. See `SentrySDKWrapper.swift` and `SentrySDKOverrides.swift` for usages. +You can also remove all stored values in user defaults by launching with `--io.sentry.wipe-data`. See `SentrySDKWrapper.swift` and `SentrySDKOverrides.swift` for usages. Note that in-app overrides don't take effect until the app is relaunched (and not simply backgrounded and then foregrounded again). This means that if you want to test changes to launch profiling, you must change the settings, then relaunch the app for the launch profile configuration to be written to disk, and then relaunch once more for the launch profile scenario to actually be tested. From 98bcbf20341aa00e42ef92c04726e2b5c6bcaaea Mon Sep 17 00:00:00 2001 From: Andrew McKnight Date: Fri, 11 Apr 2025 15:33:46 -0800 Subject: [PATCH 04/35] fix ui tests; tweak api --- .../SentrySDKPerformanceBenchmarkTests.m | 3 +- .../UserFeedbackUITests.swift | 9 +- .../iOS-Swift/Base.lproj/Main.storyboard | 26 +-- .../EnvironmentVariableTableViewCell.swift | 21 ++- .../iOS-Swift/FeaturesViewController.swift | 20 ++- .../LaunchArgumentTableViewCell.swift | 10 +- .../Profiling/ProfilingViewController.swift | 14 +- .../iOS-Swift/SentrySDKOverrides.swift | 150 ++++++++++-------- .../iOS-Swift/SentrySDKWrapper.swift | 78 ++++----- develop-docs/README.md | 2 + 10 files changed, 170 insertions(+), 163 deletions(-) diff --git a/Samples/iOS-Swift/PerformanceBenchmarks/SentrySDKPerformanceBenchmarkTests.m b/Samples/iOS-Swift/PerformanceBenchmarks/SentrySDKPerformanceBenchmarkTests.m index a3c07fdc2c6..c6a5931ad46 100644 --- a/Samples/iOS-Swift/PerformanceBenchmarks/SentrySDKPerformanceBenchmarkTests.m +++ b/Samples/iOS-Swift/PerformanceBenchmarks/SentrySDKPerformanceBenchmarkTests.m @@ -37,7 +37,8 @@ - (void)testProfilerCPUUsage [app.buttons[@"startTransactionMainThread"] tap]; - [app.tabBars[@"Tab Bar"].buttons[@"Benchmarking"] tap]; + [app.tabBars[@"Tab Bar"].buttons[@"More"] tap]; + [app.staticTexts[@"Benchmarking"] tap]; [app.buttons[@"Benchmark start"] tap]; diff --git a/Samples/iOS-Swift/iOS-Swift-UITests/UserFeedbackUITests.swift b/Samples/iOS-Swift/iOS-Swift-UITests/UserFeedbackUITests.swift index 78b4ae64c8d..47f7dcde9a7 100644 --- a/Samples/iOS-Swift/iOS-Swift-UITests/UserFeedbackUITests.swift +++ b/Samples/iOS-Swift/iOS-Swift-UITests/UserFeedbackUITests.swift @@ -14,7 +14,6 @@ class UserFeedbackUITests: BaseUITest { super.setUp() app.launchArguments.append(contentsOf: [ - "--io.sentry.feedback.auto-inject-widget", "--io.sentry.feedback.no-animations", "--io.sentry.wipe-data", @@ -59,7 +58,7 @@ extension UserFeedbackUITests { } func testUIElementsWithCustomizations() { - launchApp(args: ["--io.sentry.feedback.auto-inject-widget"]) + launchApp() // widget button text XCTAssert(app.otherElements["Report Jank"].exists) @@ -292,12 +291,6 @@ extension UserFeedbackUITests { widgetButton.tap() XCTAssert(sendButton.waitForExistence(timeout: 1)) try assertOnlyHookMarkersExist(names: [.onFormOpen]) - - messageTextView.tap() - messageTextView.typeText("UITest user feedback") - - // dismiss the onscreen keyboard - app.swipeDown(velocity: .fast) // the modal cancel gesture app.swipeDown(velocity: .fast) diff --git a/Samples/iOS-Swift/iOS-Swift/Base.lproj/Main.storyboard b/Samples/iOS-Swift/iOS-Swift/Base.lproj/Main.storyboard index 8a4263bdd42..77615a150cc 100644 --- a/Samples/iOS-Swift/iOS-Swift/Base.lproj/Main.storyboard +++ b/Samples/iOS-Swift/iOS-Swift/Base.lproj/Main.storyboard @@ -214,7 +214,7 @@ - + @@ -224,7 +224,7 @@ - + @@ -419,27 +419,8 @@ - - - - - - - - - - - - - - - + diff --git a/Samples/iOS-Swift/iOS-Swift/EnvironmentVariableTableViewCell.swift b/Samples/iOS-Swift/iOS-Swift/EnvironmentVariableTableViewCell.swift index a0a6d464464..f33f689d36c 100644 --- a/Samples/iOS-Swift/iOS-Swift/EnvironmentVariableTableViewCell.swift +++ b/Samples/iOS-Swift/iOS-Swift/EnvironmentVariableTableViewCell.swift @@ -2,11 +2,14 @@ import UIKit class EnvironmentVariableTableViewCell: UITableViewCell, UITextFieldDelegate { let titleLabel = UILabel(frame: .zero) + lazy var valueField = { let field = UITextField(frame: .zero) field.delegate = self return field }() + + var float: Bool = false var override: (any SentrySDKOverride)? override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) { @@ -23,20 +26,28 @@ class EnvironmentVariableTableViewCell: UITableViewCell, UITextFieldDelegate { fatalError("init(coder:) has not been implemented") } - func configure(with launchArgument: any SentrySDKOverride) { - titleLabel.text = launchArgument.rawValue as? String + func configure(with override: any SentrySDKOverride, float: Bool) { + titleLabel.text = override.rawValue as? String var text: String - if let value = launchArgument.value { + if let value = override.floatValue { text = String(format: "%.2f", value) + } else if let value = override.stringValue { + text = value } else { text = "nil" } valueField.text = text - self.override = launchArgument + + self.float = float + self.override = override } func textFieldDidEndEditing(_ textField: UITextField) { - override?.value = textField.text.flatMap { Float($0) } + if self.float { + override?.floatValue = textField.text.flatMap { Float($0) } + } else { + override?.stringValue = textField.text + } } } diff --git a/Samples/iOS-Swift/iOS-Swift/FeaturesViewController.swift b/Samples/iOS-Swift/iOS-Swift/FeaturesViewController.swift index 0579e742ac4..5ff6a92da9f 100644 --- a/Samples/iOS-Swift/iOS-Swift/FeaturesViewController.swift +++ b/Samples/iOS-Swift/iOS-Swift/FeaturesViewController.swift @@ -74,23 +74,33 @@ class FeaturesViewController: UITableViewController { override func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell { if indexPath.section == 2 { - if SentrySDKOverrides.Tracing.args.contains(SentrySDKOverrides.Tracing.allCases[indexPath.row]) { + if SentrySDKOverrides.Tracing.boolValues.contains(SentrySDKOverrides.Tracing.allCases[indexPath.row]) { let cell = tableView.dequeueReusableCell(withIdentifier: "launchArgumentCell", for: indexPath) as! LaunchArgumentTableViewCell cell.configure(with: SentrySDKOverrides.Tracing.allCases[indexPath.row]) return cell } else { let cell = tableView.dequeueReusableCell(withIdentifier: "environmentVariableCell", for: indexPath) as! EnvironmentVariableTableViewCell - cell.configure(with: SentrySDKOverrides.Tracing.allCases[indexPath.row]) + cell.configure(with: SentrySDKOverrides.Tracing.allCases[indexPath.row], float: true) return cell } } else if indexPath.section == 3 { - if SentrySDKOverrides.Profiling.args.contains(SentrySDKOverrides.Profiling.allCases[indexPath.row]) { + if SentrySDKOverrides.Profiling.boolValues.contains(SentrySDKOverrides.Profiling.allCases[indexPath.row]) { let cell = tableView.dequeueReusableCell(withIdentifier: "launchArgumentCell", for: indexPath) as! LaunchArgumentTableViewCell cell.configure(with: SentrySDKOverrides.Profiling.allCases[indexPath.row]) return cell } else { let cell = tableView.dequeueReusableCell(withIdentifier: "environmentVariableCell", for: indexPath) as! EnvironmentVariableTableViewCell - cell.configure(with: SentrySDKOverrides.Profiling.allCases[indexPath.row]) + cell.configure(with: SentrySDKOverrides.Profiling.allCases[indexPath.row], float: true) + return cell + } + } else if indexPath.section == 5 { + if SentrySDKOverrides.Other.boolValues.contains(SentrySDKOverrides.Other.allCases[indexPath.row]) { + let cell = tableView.dequeueReusableCell(withIdentifier: "launchArgumentCell", for: indexPath) as! LaunchArgumentTableViewCell + cell.configure(with: SentrySDKOverrides.Other.allCases[indexPath.row]) + return cell + } else { + let cell = tableView.dequeueReusableCell(withIdentifier: "environmentVariableCell", for: indexPath) as! EnvironmentVariableTableViewCell + cell.configure(with: SentrySDKOverrides.Other.allCases[indexPath.row], float: false) return cell } } @@ -102,8 +112,6 @@ class FeaturesViewController: UITableViewController { cell.configure(with: SentrySDKOverrides.Performance.allCases[indexPath.row]) } else if indexPath.section == 4 { cell.configure(with: SentrySDKOverrides.Feedback.allCases[indexPath.row]) - } else if indexPath.section == 5 { - cell.configure(with: SentrySDKOverrides.Other.allCases[indexPath.row]) } return cell } diff --git a/Samples/iOS-Swift/iOS-Swift/LaunchArgumentTableViewCell.swift b/Samples/iOS-Swift/iOS-Swift/LaunchArgumentTableViewCell.swift index 4c63d17e897..f29a3d07b17 100644 --- a/Samples/iOS-Swift/iOS-Swift/LaunchArgumentTableViewCell.swift +++ b/Samples/iOS-Swift/iOS-Swift/LaunchArgumentTableViewCell.swift @@ -10,7 +10,7 @@ class LaunchArgumentTableViewCell: UITableViewCell { var override: (any SentrySDKOverride)? @objc func toggleFlag() { - override?.set = flagSwitch.isOn + override?.boolValue = flagSwitch.isOn } override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) { @@ -25,9 +25,9 @@ class LaunchArgumentTableViewCell: UITableViewCell { fatalError("init(coder:) has not been implemented") } - func configure(with launchArgument: any SentrySDKOverride) { - titleLabel.text = launchArgument.rawValue as? String - flagSwitch.isOn = launchArgument.set - self.override = launchArgument + func configure(with override: any SentrySDKOverride) { + titleLabel.text = override.rawValue as? String + flagSwitch.isOn = override.boolValue + self.override = override } } diff --git a/Samples/iOS-Swift/iOS-Swift/Profiling/ProfilingViewController.swift b/Samples/iOS-Swift/iOS-Swift/Profiling/ProfilingViewController.swift index 15dc08263b0..549bbbf88c2 100644 --- a/Samples/iOS-Swift/iOS-Swift/Profiling/ProfilingViewController.swift +++ b/Samples/iOS-Swift/iOS-Swift/Profiling/ProfilingViewController.swift @@ -62,41 +62,41 @@ class ProfilingViewController: UIViewController, UITextFieldDelegate { @IBAction func sampleRateEdited(_ sender: UITextField) { var sampleRate = SentrySDKOverrides.Profiling.sampleRate - sampleRate.value = getSampleRateOverride(field: sender) + sampleRate.floatValue = getSampleRateOverride(field: sender) } @IBAction func tracesSampleRateEdited(_ sender: UITextField) { var sampleRate = SentrySDKOverrides.Tracing.sampleRate - sampleRate.value = getSampleRateOverride(field: sender) + sampleRate.floatValue = getSampleRateOverride(field: sender) } @IBAction func profileAppStartsToggled(_ sender: UISwitch) { var disableAppStartProfiling = SentrySDKOverrides.Profiling.disableAppStartProfiling - disableAppStartProfiling.set = sender.isOn + disableAppStartProfiling.boolValue = sender.isOn } @IBAction func defineProfilesSampleRateToggled(_ sender: UISwitch) { sampleRateField.isEnabled = sender.isOn var sampleRate = SentrySDKOverrides.Profiling.sampleRate - sampleRate.value = getSampleRateOverride(field: sampleRateField) + sampleRate.floatValue = getSampleRateOverride(field: sampleRateField) } @IBAction func defineTracesSampleRateToggled(_ sender: UISwitch) { tracesSampleRateField.isEnabled = sender.isOn var sampleRate = SentrySDKOverrides.Tracing.sampleRate - sampleRate.value = getSampleRateOverride(field: tracesSampleRateField) + sampleRate.floatValue = getSampleRateOverride(field: tracesSampleRateField) } @IBAction func traceLifecycleToggled(_ sender: UISwitch) { var manualLifecycle = SentrySDKOverrides.Profiling.manualLifecycle - manualLifecycle.set = !sender.isOn + manualLifecycle.boolValue = !sender.isOn } @IBAction func sessionSampleRateChanged(_ sender: UITextField) { var sessionSampleRate = SentrySDKOverrides.Profiling.sessionSampleRate - sessionSampleRate.value = getSampleRateOverride(field: sender) + sessionSampleRate.floatValue = getSampleRateOverride(field: sender) } // MARK: UITextFieldDelegate diff --git a/Samples/iOS-Swift/iOS-Swift/SentrySDKOverrides.swift b/Samples/iOS-Swift/iOS-Swift/SentrySDKOverrides.swift index 56a8b7aa7a0..b9ba2cfbb7e 100644 --- a/Samples/iOS-Swift/iOS-Swift/SentrySDKOverrides.swift +++ b/Samples/iOS-Swift/iOS-Swift/SentrySDKOverrides.swift @@ -1,8 +1,15 @@ import Foundation protocol SentrySDKOverride: RawRepresentable, CaseIterable { - var set: Bool { get set } - var value: Float? { get set } + var boolValue: Bool { get set } + var floatValue: Float? { get set } + var stringValue: String? { get set } +} + +extension SentrySDKOverride { + var boolValue: Bool { get { false } set { } } + var floatValue: Float? { get { nil } set { } } + var stringValue: String? { get { nil } set { } } } public enum SentrySDKOverrides { @@ -27,21 +34,12 @@ public enum SentrySDKOverrides { case wipeDataOnLaunch = "--io.sentry.wipe-data" case disableEverything = "--io.sentry.disable-everything" - public var set: Bool { - get { - getOverride(for: rawValue) - } - set(newValue) { - setUserDefaultOverride(for: rawValue, value: newValue) - } - } - - var value: Float? { + public var boolValue: Bool { get { - fatalError("Invalid") + getBoolOverride(for: rawValue) } set(newValue) { - fatalError("Invalid") + setBoolOverride(for: rawValue, value: newValue) } } } @@ -56,24 +54,15 @@ public enum SentrySDKOverrides { case requireName = "--io.sentry.feedback.require-name" case noAnimations = "--io.sentry.feedback.no-animations" - public var set: Bool { + public var boolValue: Bool { get { switch self { - case .disableAutoInject: getOverride(for: "--io.sentry.disable-everything") || getOverride(for: rawValue) - default: getOverride(for: rawValue) + case .disableAutoInject: getBoolOverride(for: rawValue) + default: getBoolOverride(for: rawValue) } } set(newValue) { - setUserDefaultOverride(for: rawValue, value: newValue) - } - } - - var value: Float? { - get { - fatalError("Invalid") - } - set(newValue) { - fatalError("Invalid") + setBoolOverride(for: rawValue, value: newValue) } } } @@ -93,21 +82,12 @@ public enum SentrySDKOverrides { case disablePrewarmedAppStartTracing = "--disable-prewarmed-app-start-tracing" case disablePerformanceTracing = "--disable-auto-performance-tracing" - public var set: Bool { + public var boolValue: Bool { get { - getOverride(for: "--io.sentry.disable-everything") || getOverride(for: rawValue) + getBoolOverride(for: "--io.sentry.disable-everything") || getBoolOverride(for: rawValue) } set(newValue) { - setUserDefaultOverride(for: rawValue, value: newValue) - } - } - - var value: Float? { - get { - fatalError("Invalid") - } - set(newValue) { - fatalError("Invalid") + setBoolOverride(for: rawValue, value: newValue) } } } @@ -122,24 +102,37 @@ public enum SentrySDKOverrides { case disableSwizzling = "--disable-swizzling" case disableCrashHandling = "--disable-crash-handler" case disableSpotlight = "--disable-spotlight" + case userName = "--io.sentry.user.name" + case userEmail = "--io.sentry.user.email" - public var set: Bool { + public var boolValue: Bool { get { - getOverride(for: "--io.sentry.disable-everything") || getOverride(for: rawValue) + getBoolOverride(for: "--io.sentry.disable-everything") || getBoolOverride(for: rawValue) } set(newValue) { - setUserDefaultOverride(for: rawValue, value: newValue) + setBoolOverride(for: rawValue, value: newValue) } } - var value: Float? { + var stringValue: String? { get { - fatalError("Invalid") + switch self { + case .userName, .userEmail: + return getStringValueOverride(for: rawValue) + default: fatalError("Invalid") + } } set(newValue) { - fatalError("Invalid") + switch self { + case .userName, .userEmail: + return setStringOverride(for: rawValue, value: newValue) + default: fatalError("Invalid") + } } } + + public static var boolValues: [Other] { [.disableAttachScreenshot, .disableAttachViewHierarchy, .disableSessionReplay, .disableMetricKit, .disableBreadcrumbs, .disableNetworkBreadcrumbs, .disableSwizzling, .disableCrashHandling, .disableSpotlight] } + public static var stringVars: [Other] { [.userName, .userEmail] } } public enum Tracing: String, SentrySDKOverride { @@ -147,38 +140,38 @@ public enum SentrySDKOverrides { case samplerValue = "--io.sentry.tracesSamplerValue" case disableTracing = "--io.sentry.disable-tracing" - public var set: Bool { + public var boolValue: Bool { get { switch self { case .sampleRate, .samplerValue: fatalError("Invalid") - default: getOverride(for: "--io.sentry.disable-everything") || getOverride(for: rawValue) + default: getBoolOverride(for: "--io.sentry.disable-everything") || getBoolOverride(for: rawValue) } } set(newValue) { switch self { case .sampleRate, .samplerValue: fatalError("Invalid") - default: setUserDefaultOverride(for: rawValue, value: newValue) + default: setBoolOverride(for: rawValue, value: newValue) } } } - public var value: Float? { + public var floatValue: Float? { get { switch self { case .disableTracing: fatalError("Invalid") - default: getValueOverride(for: rawValue) + default: getFloatValueOverride(for: rawValue) } } set(newValue) { switch self { case .disableTracing: fatalError("Invalid") - default: setUserDefaultOverride(for: rawValue, value: newValue) + default: setFloatOverride(for: rawValue, value: newValue) } } } - public static var args: [Tracing] { [.disableTracing] } - public static var vars: [Tracing] { [.sampleRate, .samplerValue] } + public static var boolValues: [Tracing] { [.disableTracing] } + public static var floatValues: [Tracing] { [.sampleRate, .samplerValue] } } public enum Profiling: String, SentrySDKOverride { @@ -189,57 +182,76 @@ public enum SentrySDKOverrides { case sessionSampleRate = "--io.sentry.profile-session-sample-rate" case disableUIProfiling = "--io.sentry.disable-ui-profiling" - public var set: Bool { + public var boolValue: Bool { get { switch self { case .sampleRate, .samplerValue, .sessionSampleRate: fatalError("Invalid") - case .disableUIProfiling, .disableAppStartProfiling: getOverride(for: "--io.sentry.disable-everything") || getOverride(for: rawValue) - default: getOverride(for: rawValue) + case .disableUIProfiling, .disableAppStartProfiling: getBoolOverride(for: "--io.sentry.disable-everything") || getBoolOverride(for: rawValue) + default: getBoolOverride(for: rawValue) } } set(newValue) { switch self { case .sampleRate, .samplerValue, .sessionSampleRate: fatalError("Invalid") - default: setUserDefaultOverride(for: rawValue, value: newValue) + default: setBoolOverride(for: rawValue, value: newValue) } } } - public var value: Float? { + public var floatValue: Float? { get { switch self { case .disableUIProfiling, .disableAppStartProfiling, .manualLifecycle: fatalError("Invalid") - default: getValueOverride(for: rawValue) + default: getFloatValueOverride(for: rawValue) } } set(newValue) { switch self { case .disableUIProfiling, .disableAppStartProfiling, .manualLifecycle: fatalError("Invalid") - default: setUserDefaultOverride(for: rawValue, value: newValue) + default: setFloatOverride(for: rawValue, value: newValue) } } } - public static var args: [Profiling] { [.disableUIProfiling, .disableAppStartProfiling, .manualLifecycle] } - public static var vars: [Profiling] { [.sampleRate, .samplerValue, .sessionSampleRate] } + public static var boolValues: [Profiling] { [.disableUIProfiling, .disableAppStartProfiling, .manualLifecycle] } + public static var floatValues: [Profiling] { [.sampleRate, .samplerValue, .sessionSampleRate] } } } private extension SentrySDKOverrides { - static func getOverride(for key: String) -> Bool { + static func getBoolOverride(for key: String) -> Bool { ProcessInfo.processInfo.arguments.contains(key) || defaults.bool(forKey: key) } - - static func setUserDefaultOverride(for key: String, value: Any?) { + + static func setBoolOverride(for key: String, value: Bool) { + defaults.set(value, forKey: key) + } + + static func setFloatOverride(for key: String, value: Float?) { + guard let value = value else { + defaults.removeObject(forKey: key) + return + } + + setStringOverride(for: key, value: String(format: "%f", value)) + } + + static func setStringOverride(for key: String, value: String?) { defaults.set(value, forKey: key) } - static func getValueOverride(for key: String) -> T? where T: LosslessStringConvertible { - var schemaEnvironmentVariable: T? + static func getFloatValueOverride(for key: String) -> Float? { + (getStringValueOverride(for: key) as? NSString)?.floatValue + } + + static func getStringValueOverride(for key: String) -> String? { + var schemaEnvironmentVariable: String? if let value = ProcessInfo.processInfo.environment[key] { - schemaEnvironmentVariable = value as? T + schemaEnvironmentVariable = value } - let defaultsValue = defaults.object(forKey: key) as? T + + let defaultsValue = defaults.string(forKey: key) + if schemaPrecedenceForEnvironmentVariables { return schemaEnvironmentVariable ?? defaultsValue } else { diff --git a/Samples/iOS-Swift/iOS-Swift/SentrySDKWrapper.swift b/Samples/iOS-Swift/iOS-Swift/SentrySDKWrapper.swift index 6e62be139ee..7365fe2787e 100644 --- a/Samples/iOS-Swift/iOS-Swift/SentrySDKWrapper.swift +++ b/Samples/iOS-Swift/iOS-Swift/SentrySDKWrapper.swift @@ -18,7 +18,7 @@ struct SentrySDKWrapper { options.beforeCaptureViewHierarchy = { _ in true } options.debug = true - if #available(iOS 16.0, *), SentrySDKOverrides.Other.disableSessionReplay.set { + if #available(iOS 16.0, *), SentrySDKOverrides.Other.disableSessionReplay.boolValue { options.sessionReplay = SentryReplayOptions( sessionSampleRate: 0, onErrorSampleRate: 1, @@ -28,16 +28,16 @@ struct SentrySDKWrapper { options.sessionReplay.quality = .high } - if #available(iOS 15.0, *), SentrySDKOverrides.Other.disableMetricKit.set { + if #available(iOS 15.0, *), SentrySDKOverrides.Other.disableMetricKit.boolValue { options.enableMetricKit = true options.enableMetricKitRawPayload = true } options.tracesSampleRate = 1 - if let sampleRate = SentrySDKOverrides.Tracing.sampleRate.value { + if let sampleRate = SentrySDKOverrides.Tracing.sampleRate.floatValue { options.tracesSampleRate = NSNumber(value: sampleRate) } - if let samplerValue = SentrySDKOverrides.Tracing.samplerValue.value { + if let samplerValue = SentrySDKOverrides.Tracing.samplerValue.floatValue { options.tracesSampler = { _ in return NSNumber(value: samplerValue) } @@ -45,7 +45,7 @@ struct SentrySDKWrapper { configureProfiling(options) - options.enableAutoSessionTracking = SentrySDKOverrides.Performance.disableSessionTracking.set + options.enableAutoSessionTracking = SentrySDKOverrides.Performance.disableSessionTracking.boolValue if let sessionTrackingIntervalMillis = env["--io.sentry.sessionTrackingIntervalMillis"] { options.sessionTrackingIntervalMillis = UInt((sessionTrackingIntervalMillis as NSString).integerValue) } @@ -53,36 +53,36 @@ struct SentrySDKWrapper { options.add(inAppInclude: "iOS_External") // the benchmark test starts and stops a custom transaction using a UIButton, and automatic user interaction tracing stops the transaction that begins with that button press after the idle timeout elapses, stopping the profiler (only one profiler runs regardless of the number of concurrent transactions) - options.enableUserInteractionTracing = !isBenchmarking && !SentrySDKOverrides.Performance.disableUITracing.set + options.enableUserInteractionTracing = !isBenchmarking && !SentrySDKOverrides.Performance.disableUITracing.boolValue // disable during benchmarks because we run CPU for 15 seconds at full throttle which can trigger ANRs - options.enableAppHangTracking = !isBenchmarking && !SentrySDKOverrides.Performance.disableANRTracking.set + options.enableAppHangTracking = !isBenchmarking && !SentrySDKOverrides.Performance.disableANRTracking.boolValue // UI tests generate false OOMs - options.enableWatchdogTerminationTracking = !isUITest && !isBenchmarking && !SentrySDKOverrides.Performance.disableWatchdogTracking.set + options.enableWatchdogTerminationTracking = !isUITest && !isBenchmarking && !SentrySDKOverrides.Performance.disableWatchdogTracking.boolValue - options.enableAutoPerformanceTracing = !isBenchmarking && !SentrySDKOverrides.Performance.disablePerformanceTracing.set - options.enablePreWarmedAppStartTracing = !isBenchmarking && !SentrySDKOverrides.Performance.disablePrewarmedAppStartTracing.set - options.enableTracing = !isBenchmarking && !SentrySDKOverrides.Tracing.disableTracing.set + options.enableAutoPerformanceTracing = !isBenchmarking && !SentrySDKOverrides.Performance.disablePerformanceTracing.boolValue + options.enablePreWarmedAppStartTracing = !isBenchmarking && !SentrySDKOverrides.Performance.disablePrewarmedAppStartTracing.boolValue + options.enableTracing = !isBenchmarking && !SentrySDKOverrides.Tracing.disableTracing.boolValue - options.enableFileIOTracing = !SentrySDKOverrides.Performance.disableFileIOTracing.set - options.enableAutoBreadcrumbTracking = !SentrySDKOverrides.Other.disableBreadcrumbs.set - options.enableUIViewControllerTracing = !SentrySDKOverrides.Performance.disableUIVCTracing.set - options.enableNetworkTracking = !SentrySDKOverrides.Performance.disableNetworkTracing.set - options.enableCoreDataTracing = !SentrySDKOverrides.Performance.disableCoreDataTracing.set - options.enableNetworkBreadcrumbs = !SentrySDKOverrides.Other.disableNetworkBreadcrumbs.set - options.enableSwizzling = !SentrySDKOverrides.Other.disableSwizzling.set - options.enableCrashHandler = !SentrySDKOverrides.Other.disableCrashHandling.set + options.enableFileIOTracing = !SentrySDKOverrides.Performance.disableFileIOTracing.boolValue + options.enableAutoBreadcrumbTracking = !SentrySDKOverrides.Other.disableBreadcrumbs.boolValue + options.enableUIViewControllerTracing = !SentrySDKOverrides.Performance.disableUIVCTracing.boolValue + options.enableNetworkTracking = !SentrySDKOverrides.Performance.disableNetworkTracing.boolValue + options.enableCoreDataTracing = !SentrySDKOverrides.Performance.disableCoreDataTracing.boolValue + options.enableNetworkBreadcrumbs = !SentrySDKOverrides.Other.disableNetworkBreadcrumbs.boolValue + options.enableSwizzling = !SentrySDKOverrides.Other.disableSwizzling.boolValue + options.enableCrashHandler = !SentrySDKOverrides.Other.disableCrashHandling.boolValue options.enablePersistingTracesWhenCrashing = true - options.attachScreenshot = !SentrySDKOverrides.Other.disableAttachScreenshot.set - options.attachViewHierarchy = !SentrySDKOverrides.Other.disableAttachViewHierarchy.set - options.enableTimeToFullDisplayTracing = !SentrySDKOverrides.Performance.disableTimeToFullDisplayTracing.set - options.enablePerformanceV2 = !SentrySDKOverrides.Performance.disablePerformanceV2.set - options.enableAppHangTrackingV2 = !SentrySDKOverrides.Performance.disableAppHangTrackingV2.set + options.attachScreenshot = !SentrySDKOverrides.Other.disableAttachScreenshot.boolValue + options.attachViewHierarchy = !SentrySDKOverrides.Other.disableAttachViewHierarchy.boolValue + options.enableTimeToFullDisplayTracing = !SentrySDKOverrides.Performance.disableTimeToFullDisplayTracing.boolValue + options.enablePerformanceV2 = !SentrySDKOverrides.Performance.disablePerformanceV2.boolValue + options.enableAppHangTrackingV2 = !SentrySDKOverrides.Performance.disableAppHangTrackingV2.boolValue options.failedRequestStatusCodes = [ HttpStatusCodeRange(min: 400, max: 599) ] #if targetEnvironment(simulator) - options.enableSpotlight = !SentrySDKOverrides.Other.disableSpotlight.set + options.enableSpotlight = !SentrySDKOverrides.Other.disableSpotlight.boolValue #else options.enableSpotlight = false #endif // targetEnvironment(simulator) @@ -158,7 +158,7 @@ extension SentrySDKWrapper { var layoutOffset: UIOffset { UIOffset(horizontal: 25, vertical: 75) } func configureFeedbackWidget(config: SentryUserFeedbackWidgetConfiguration) { - guard !SentrySDKOverrides.Feedback.disableAutoInject.set else { + guard !SentrySDKOverrides.Feedback.disableAutoInject.boolValue else { config.autoInject = false return } @@ -176,19 +176,19 @@ extension SentrySDKWrapper { } config.layoutUIOffset = layoutOffset - if SentrySDKOverrides.Feedback.noWidgetText.set { + if SentrySDKOverrides.Feedback.noWidgetText.boolValue { config.labelText = nil } - if SentrySDKOverrides.Feedback.noWidgetIcon.set { + if SentrySDKOverrides.Feedback.noWidgetIcon.boolValue { config.showIcon = false } } func configureFeedbackForm(config: SentryUserFeedbackFormConfiguration) { - config.useSentryUser = !SentrySDKOverrides.Feedback.noUserInjection.set + config.useSentryUser = !SentrySDKOverrides.Feedback.noUserInjection.boolValue config.formTitle = "Jank Report" - config.isEmailRequired = SentrySDKOverrides.Feedback.requireEmail.set - config.isNameRequired = SentrySDKOverrides.Feedback.requireName.set + config.isEmailRequired = SentrySDKOverrides.Feedback.requireEmail.boolValue + config.isNameRequired = SentrySDKOverrides.Feedback.requireName.boolValue config.submitButtonLabel = "Report that jank" config.removeScreenshotButtonLabel = "Oof too nsfl" config.cancelButtonLabel = "What, me worry?" @@ -232,7 +232,7 @@ extension SentrySDKWrapper { return } - config.animations = !SentrySDKOverrides.Feedback.noAnimations.set + config.animations = !SentrySDKOverrides.Feedback.noAnimations.boolValue config.useShakeGesture = true config.showFormForScreenshots = true config.configureWidget = configureFeedbackWidget(config:) @@ -374,21 +374,21 @@ extension SentrySDKWrapper { // MARK: Profiling configuration extension SentrySDKWrapper { func configureProfiling(_ options: Options) { - if let sampleRate = SentrySDKOverrides.Profiling.sampleRate.value { + if let sampleRate = SentrySDKOverrides.Profiling.sampleRate.floatValue { options.profilesSampleRate = NSNumber(value: sampleRate) } - if let samplerValue = SentrySDKOverrides.Profiling.samplerValue.value { + if let samplerValue = SentrySDKOverrides.Profiling.samplerValue.floatValue { options.profilesSampler = { _ in return NSNumber(value: samplerValue) } } - options.enableAppLaunchProfiling = !SentrySDKOverrides.Profiling.disableAppStartProfiling.set + options.enableAppLaunchProfiling = !SentrySDKOverrides.Profiling.disableAppStartProfiling.boolValue - if !SentrySDKOverrides.Profiling.disableUIProfiling.set { + if !SentrySDKOverrides.Profiling.disableUIProfiling.boolValue { options.configureProfiling = { - $0.lifecycle = SentrySDKOverrides.Profiling.manualLifecycle.set ? .manual : .trace - $0.sessionSampleRate = SentrySDKOverrides.Profiling.sessionSampleRate.value ?? 1 - $0.profileAppStarts = !SentrySDKOverrides.Profiling.disableAppStartProfiling.set + $0.lifecycle = SentrySDKOverrides.Profiling.manualLifecycle.boolValue ? .manual : .trace + $0.sessionSampleRate = SentrySDKOverrides.Profiling.sessionSampleRate.floatValue ?? 1 + $0.profileAppStarts = !SentrySDKOverrides.Profiling.disableAppStartProfiling.boolValue } } } diff --git a/develop-docs/README.md b/develop-docs/README.md index 062384d9610..24a5da65b49 100644 --- a/develop-docs/README.md +++ b/develop-docs/README.md @@ -201,6 +201,8 @@ The iOS-Swift and iOS-ObjectiveC sample apps have schema launch args and environ In iOS-Swift, these can also be modified at runtime, to help test various configurations in scenarios where using launch args and environment variables isn't possible, like TestFlight builds. Runtime overrides are set via `UserDefaults`. They interact with schema launch arguments and environment variables as follows: - Boolean flags are ORed together: if either a `true` is set in User Defaults, or a launch argument is set, then the override takes effect. - Values written to user defaults take precedence over schema environment variables by default. If you want to give precedence to schema environment vars over user defaults values, enable the launch arg `--io.sentry.schema-environment-variable-precedence`. +Note that if a key we use to write a boolean value to defaults isn't present in defaults, then UserDefaults returns `false` for the query by default. We write all environment variables as strings, so that by default, if the associated key isn't present, `UserDefaults` returns `nil` (if we directly wrote and read Floats, for example, defaults would return `0` if the key isn't present, and we'd have to do more work to disambiguate that from having overridden it to 0, for cases where 0 isn't the default we want to set in the sample app). + You can see the current override value being used in the "Features" tab. You can also remove all stored values in user defaults by launching with `--io.sentry.wipe-data`. See `SentrySDKWrapper.swift` and `SentrySDKOverrides.swift` for usages. From 58243258b5a962450ea69594e54a3b1aefb69490 Mon Sep 17 00:00:00 2001 From: Andrew McKnight Date: Fri, 11 Apr 2025 15:49:34 -0800 Subject: [PATCH 05/35] fix build on older xcodes --- .../iOS-Swift/ExtraViewController.swift | 2 +- .../iOS-Swift/SentrySDKOverrides.swift | 26 +++++++++---------- 2 files changed, 13 insertions(+), 15 deletions(-) diff --git a/Samples/iOS-Swift/iOS-Swift/ExtraViewController.swift b/Samples/iOS-Swift/iOS-Swift/ExtraViewController.swift index 21674873ef1..e84f9265128 100644 --- a/Samples/iOS-Swift/iOS-Swift/ExtraViewController.swift +++ b/Samples/iOS-Swift/iOS-Swift/ExtraViewController.swift @@ -297,7 +297,7 @@ class ExtraViewController: UIViewController { } var waitingForFeedbackAttachment = false let parsedEnvelopeContents = envelopeFileContents.split(separator: "\n").map { line in - if let imageData = Data(base64Encoded: String(line), options: []) { + if let _ = Data(base64Encoded: String(line), options: []) { guard !waitingForFeedbackAttachment else { waitingForFeedbackAttachment = false return EnvelopeContent.feedbackAttachment(String(line)) diff --git a/Samples/iOS-Swift/iOS-Swift/SentrySDKOverrides.swift b/Samples/iOS-Swift/iOS-Swift/SentrySDKOverrides.swift index b9ba2cfbb7e..65c12cc9f45 100644 --- a/Samples/iOS-Swift/iOS-Swift/SentrySDKOverrides.swift +++ b/Samples/iOS-Swift/iOS-Swift/SentrySDKOverrides.swift @@ -36,7 +36,7 @@ public enum SentrySDKOverrides { public var boolValue: Bool { get { - getBoolOverride(for: rawValue) + return getBoolOverride(for: rawValue) } set(newValue) { setBoolOverride(for: rawValue, value: newValue) @@ -57,8 +57,8 @@ public enum SentrySDKOverrides { public var boolValue: Bool { get { switch self { - case .disableAutoInject: getBoolOverride(for: rawValue) - default: getBoolOverride(for: rawValue) + case .disableAutoInject: return getBoolOverride(for: rawValue) + default: return getBoolOverride(for: rawValue) } } set(newValue) { @@ -84,7 +84,7 @@ public enum SentrySDKOverrides { public var boolValue: Bool { get { - getBoolOverride(for: "--io.sentry.disable-everything") || getBoolOverride(for: rawValue) + return getBoolOverride(for: "--io.sentry.disable-everything") || getBoolOverride(for: rawValue) } set(newValue) { setBoolOverride(for: rawValue, value: newValue) @@ -107,7 +107,7 @@ public enum SentrySDKOverrides { public var boolValue: Bool { get { - getBoolOverride(for: "--io.sentry.disable-everything") || getBoolOverride(for: rawValue) + return getBoolOverride(for: "--io.sentry.disable-everything") || getBoolOverride(for: rawValue) } set(newValue) { setBoolOverride(for: rawValue, value: newValue) @@ -117,15 +117,13 @@ public enum SentrySDKOverrides { var stringValue: String? { get { switch self { - case .userName, .userEmail: - return getStringValueOverride(for: rawValue) + case .userName, .userEmail: return getStringValueOverride(for: rawValue) default: fatalError("Invalid") } } set(newValue) { switch self { - case .userName, .userEmail: - return setStringOverride(for: rawValue, value: newValue) + case .userName, .userEmail: return setStringOverride(for: rawValue, value: newValue) default: fatalError("Invalid") } } @@ -144,7 +142,7 @@ public enum SentrySDKOverrides { get { switch self { case .sampleRate, .samplerValue: fatalError("Invalid") - default: getBoolOverride(for: "--io.sentry.disable-everything") || getBoolOverride(for: rawValue) + default: return getBoolOverride(for: "--io.sentry.disable-everything") || getBoolOverride(for: rawValue) } } set(newValue) { @@ -159,7 +157,7 @@ public enum SentrySDKOverrides { get { switch self { case .disableTracing: fatalError("Invalid") - default: getFloatValueOverride(for: rawValue) + default: return getFloatValueOverride(for: rawValue) } } set(newValue) { @@ -186,8 +184,8 @@ public enum SentrySDKOverrides { get { switch self { case .sampleRate, .samplerValue, .sessionSampleRate: fatalError("Invalid") - case .disableUIProfiling, .disableAppStartProfiling: getBoolOverride(for: "--io.sentry.disable-everything") || getBoolOverride(for: rawValue) - default: getBoolOverride(for: rawValue) + case .disableUIProfiling, .disableAppStartProfiling: return getBoolOverride(for: "--io.sentry.disable-everything") || getBoolOverride(for: rawValue) + default: return getBoolOverride(for: rawValue) } } set(newValue) { @@ -202,7 +200,7 @@ public enum SentrySDKOverrides { get { switch self { case .disableUIProfiling, .disableAppStartProfiling, .manualLifecycle: fatalError("Invalid") - default: getFloatValueOverride(for: rawValue) + default: return getFloatValueOverride(for: rawValue) } } set(newValue) { From 8b97b5cca3911715efff710eba0ab7e34b5c5ff5 Mon Sep 17 00:00:00 2001 From: Andrew McKnight Date: Fri, 11 Apr 2025 15:56:16 -0800 Subject: [PATCH 06/35] missed negating a couple "disable" overrides --- Samples/iOS-Swift/iOS-Swift/SentrySDKWrapper.swift | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Samples/iOS-Swift/iOS-Swift/SentrySDKWrapper.swift b/Samples/iOS-Swift/iOS-Swift/SentrySDKWrapper.swift index 7365fe2787e..cd0fa22aee4 100644 --- a/Samples/iOS-Swift/iOS-Swift/SentrySDKWrapper.swift +++ b/Samples/iOS-Swift/iOS-Swift/SentrySDKWrapper.swift @@ -18,7 +18,7 @@ struct SentrySDKWrapper { options.beforeCaptureViewHierarchy = { _ in true } options.debug = true - if #available(iOS 16.0, *), SentrySDKOverrides.Other.disableSessionReplay.boolValue { + if #available(iOS 16.0, *), !SentrySDKOverrides.Other.disableSessionReplay.boolValue { options.sessionReplay = SentryReplayOptions( sessionSampleRate: 0, onErrorSampleRate: 1, @@ -28,7 +28,7 @@ struct SentrySDKWrapper { options.sessionReplay.quality = .high } - if #available(iOS 15.0, *), SentrySDKOverrides.Other.disableMetricKit.boolValue { + if #available(iOS 15.0, *), !SentrySDKOverrides.Other.disableMetricKit.boolValue { options.enableMetricKit = true options.enableMetricKitRawPayload = true } @@ -45,7 +45,7 @@ struct SentrySDKWrapper { configureProfiling(options) - options.enableAutoSessionTracking = SentrySDKOverrides.Performance.disableSessionTracking.boolValue + options.enableAutoSessionTracking = !SentrySDKOverrides.Performance.disableSessionTracking.boolValue if let sessionTrackingIntervalMillis = env["--io.sentry.sessionTrackingIntervalMillis"] { options.sessionTrackingIntervalMillis = UInt((sessionTrackingIntervalMillis as NSString).integerValue) } From ebb79000cdd716c8eabd095ad3be88780dc7074b Mon Sep 17 00:00:00 2001 From: Andrew McKnight Date: Fri, 11 Apr 2025 16:27:38 -0800 Subject: [PATCH 07/35] add missing launch arg for file manager swizzling; helps with downstream PRs --- .../xcshareddata/xcschemes/iOS-Swift.xcscheme | 4 ++++ Samples/iOS-Swift/iOS-Swift/SentrySDKOverrides.swift | 12 ++++++++---- Samples/iOS-Swift/iOS-Swift/SentrySDKWrapper.swift | 2 +- 3 files changed, 13 insertions(+), 5 deletions(-) diff --git a/Samples/iOS-Swift/iOS-Swift.xcodeproj/xcshareddata/xcschemes/iOS-Swift.xcscheme b/Samples/iOS-Swift/iOS-Swift.xcodeproj/xcshareddata/xcschemes/iOS-Swift.xcscheme index 01bdc9d9ae5..8afce71a254 100644 --- a/Samples/iOS-Swift/iOS-Swift.xcodeproj/xcshareddata/xcschemes/iOS-Swift.xcscheme +++ b/Samples/iOS-Swift/iOS-Swift.xcodeproj/xcshareddata/xcschemes/iOS-Swift.xcscheme @@ -236,6 +236,10 @@ argument = "--io.sentry.feedback.no-auto-inject-widget" isEnabled = "NO"> + + Date: Fri, 11 Apr 2025 17:40:27 -0800 Subject: [PATCH 08/35] put back schema config --- .../xcshareddata/xcschemes/iOS-Swift.xcscheme | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Samples/iOS-Swift/iOS-Swift.xcodeproj/xcshareddata/xcschemes/iOS-Swift.xcscheme b/Samples/iOS-Swift/iOS-Swift.xcodeproj/xcshareddata/xcschemes/iOS-Swift.xcscheme index 8afce71a254..081a68f7f53 100644 --- a/Samples/iOS-Swift/iOS-Swift.xcodeproj/xcshareddata/xcschemes/iOS-Swift.xcscheme +++ b/Samples/iOS-Swift/iOS-Swift.xcodeproj/xcshareddata/xcschemes/iOS-Swift.xcscheme @@ -190,7 +190,7 @@ + isEnabled = "NO"> + value = "" + isEnabled = "NO"> Date: Wed, 9 Apr 2025 13:03:06 -0800 Subject: [PATCH 09/35] ref: create shared lib for sample apps --- .../project.pbxproj | 328 ++++++++++++++++++ 1 file changed, 328 insertions(+) create mode 100644 Samples/SentrySampleShared-Swift/SentrySampleShared.xcodeproj/project.pbxproj diff --git a/Samples/SentrySampleShared-Swift/SentrySampleShared.xcodeproj/project.pbxproj b/Samples/SentrySampleShared-Swift/SentrySampleShared.xcodeproj/project.pbxproj new file mode 100644 index 00000000000..eef38dc6c81 --- /dev/null +++ b/Samples/SentrySampleShared-Swift/SentrySampleShared.xcodeproj/project.pbxproj @@ -0,0 +1,328 @@ +// !$*UTF8*$! +{ + archiveVersion = 1; + classes = { + }; + objectVersion = 77; + objects = { + +/* Begin PBXBuildFile section */ + 842D54B02DA713F900D3528B /* Sentry.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 842D54AF2DA713F900D3528B /* Sentry.framework */; }; +/* End PBXBuildFile section */ + +/* Begin PBXCopyFilesBuildPhase section */ + 842D547C2DA712C200D3528B /* CopyFiles */ = { + isa = PBXCopyFilesBuildPhase; + buildActionMask = 2147483647; + dstPath = "include/$(PRODUCT_NAME)"; + dstSubfolderSpec = 16; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXCopyFilesBuildPhase section */ + +/* Begin PBXFileReference section */ + 842D547E2DA712C200D3528B /* libSentrySampleShared-Swift.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libSentrySampleShared-Swift.a"; sourceTree = BUILT_PRODUCTS_DIR; }; + 842D54AF2DA713F900D3528B /* Sentry.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; path = Sentry.framework; sourceTree = BUILT_PRODUCTS_DIR; }; +/* End PBXFileReference section */ + +/* Begin PBXFileSystemSynchronizedRootGroup section */ + 842D54802DA712C200D3528B /* SentrySampleShared-Swift */ = { + isa = PBXFileSystemSynchronizedRootGroup; + path = "SentrySampleShared-Swift"; + sourceTree = ""; + }; +/* End PBXFileSystemSynchronizedRootGroup section */ + +/* Begin PBXFrameworksBuildPhase section */ + 842D547B2DA712C200D3528B /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + 842D54B02DA713F900D3528B /* Sentry.framework in Frameworks */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXFrameworksBuildPhase section */ + +/* Begin PBXGroup section */ + 842D54752DA712C200D3528B = { + isa = PBXGroup; + children = ( + 842D54802DA712C200D3528B /* SentrySampleShared-Swift */, + 842D54AE2DA713F900D3528B /* Frameworks */, + 842D547F2DA712C200D3528B /* Products */, + ); + sourceTree = ""; + }; + 842D547F2DA712C200D3528B /* Products */ = { + isa = PBXGroup; + children = ( + 842D547E2DA712C200D3528B /* libSentrySampleShared-Swift.a */, + ); + name = Products; + sourceTree = ""; + }; + 842D54AE2DA713F900D3528B /* Frameworks */ = { + isa = PBXGroup; + children = ( + 842D54AF2DA713F900D3528B /* Sentry.framework */, + ); + name = Frameworks; + sourceTree = ""; + }; +/* End PBXGroup section */ + +/* Begin PBXNativeTarget section */ + 842D547D2DA712C200D3528B /* SentrySampleShared-Swift */ = { + isa = PBXNativeTarget; + buildConfigurationList = 842D54852DA712C200D3528B /* Build configuration list for PBXNativeTarget "SentrySampleShared-Swift" */; + buildPhases = ( + 842D547A2DA712C200D3528B /* Sources */, + 842D547B2DA712C200D3528B /* Frameworks */, + 842D547C2DA712C200D3528B /* CopyFiles */, + ); + buildRules = ( + ); + dependencies = ( + ); + fileSystemSynchronizedGroups = ( + 842D54802DA712C200D3528B /* SentrySampleShared-Swift */, + ); + name = "SentrySampleShared-Swift"; + packageProductDependencies = ( + ); + productName = "SentrySampleShared-Swift"; + productReference = 842D547E2DA712C200D3528B /* libSentrySampleShared-Swift.a */; + productType = "com.apple.product-type.library.static"; + }; +/* End PBXNativeTarget section */ + +/* Begin PBXProject section */ + 842D54762DA712C200D3528B /* Project object */ = { + isa = PBXProject; + attributes = { + BuildIndependentTargetsInParallel = 1; + LastSwiftUpdateCheck = 1620; + LastUpgradeCheck = 1620; + TargetAttributes = { + 842D547D2DA712C200D3528B = { + CreatedOnToolsVersion = 16.2; + LastSwiftMigration = 1620; + }; + }; + }; + buildConfigurationList = 842D54792DA712C200D3528B /* Build configuration list for PBXProject "SentrySampleShared" */; + developmentRegion = en; + hasScannedForEncodings = 0; + knownRegions = ( + en, + Base, + ); + mainGroup = 842D54752DA712C200D3528B; + minimizedProjectReferenceProxies = 1; + preferredProjectObjectVersion = 77; + productRefGroup = 842D547F2DA712C200D3528B /* Products */; + projectDirPath = ""; + projectRoot = ""; + targets = ( + 842D547D2DA712C200D3528B /* SentrySampleShared-Swift */, + ); + }; +/* End PBXProject section */ + +/* Begin PBXSourcesBuildPhase section */ + 842D547A2DA712C200D3528B /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXSourcesBuildPhase section */ + +/* Begin XCBuildConfiguration section */ + 842D54832DA712C200D3528B /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + ASSETCATALOG_COMPILER_GENERATE_SWIFT_ASSET_SYMBOL_EXTENSIONS = YES; + CLANG_ANALYZER_NONNULL = YES; + CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++20"; + CLANG_ENABLE_MODULES = YES; + CLANG_ENABLE_OBJC_ARC = YES; + CLANG_ENABLE_OBJC_WEAK = YES; + CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_COMMA = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; + CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; + CLANG_WARN_DOCUMENTATION_COMMENTS = YES; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INFINITE_RECURSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; + CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; + CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; + CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES; + CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; + CLANG_WARN_STRICT_PROTOTYPES = YES; + CLANG_WARN_SUSPICIOUS_MOVE = YES; + CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; + CLANG_WARN_UNREACHABLE_CODE = YES; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + COPY_PHASE_STRIP = NO; + DEBUG_INFORMATION_FORMAT = dwarf; + ENABLE_STRICT_OBJC_MSGSEND = YES; + ENABLE_TESTABILITY = YES; + ENABLE_USER_SCRIPT_SANDBOXING = YES; + GCC_C_LANGUAGE_STANDARD = gnu17; + GCC_DYNAMIC_NO_PIC = NO; + GCC_NO_COMMON_BLOCKS = YES; + GCC_OPTIMIZATION_LEVEL = 0; + GCC_PREPROCESSOR_DEFINITIONS = ( + "DEBUG=1", + "$(inherited)", + ); + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; + GCC_WARN_UNDECLARED_SELECTOR = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; + GCC_WARN_UNUSED_FUNCTION = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + IPHONEOS_DEPLOYMENT_TARGET = 18.2; + LOCALIZATION_PREFERS_STRING_CATALOGS = YES; + MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE; + MTL_FAST_MATH = YES; + ONLY_ACTIVE_ARCH = YES; + SDKROOT = iphoneos; + SWIFT_ACTIVE_COMPILATION_CONDITIONS = "DEBUG $(inherited)"; + SWIFT_OPTIMIZATION_LEVEL = "-Onone"; + }; + name = Debug; + }; + 842D54842DA712C200D3528B /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + ASSETCATALOG_COMPILER_GENERATE_SWIFT_ASSET_SYMBOL_EXTENSIONS = YES; + CLANG_ANALYZER_NONNULL = YES; + CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++20"; + CLANG_ENABLE_MODULES = YES; + CLANG_ENABLE_OBJC_ARC = YES; + CLANG_ENABLE_OBJC_WEAK = YES; + CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_COMMA = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; + CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; + CLANG_WARN_DOCUMENTATION_COMMENTS = YES; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INFINITE_RECURSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; + CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; + CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; + CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES; + CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; + CLANG_WARN_STRICT_PROTOTYPES = YES; + CLANG_WARN_SUSPICIOUS_MOVE = YES; + CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; + CLANG_WARN_UNREACHABLE_CODE = YES; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + COPY_PHASE_STRIP = NO; + DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; + ENABLE_NS_ASSERTIONS = NO; + ENABLE_STRICT_OBJC_MSGSEND = YES; + ENABLE_USER_SCRIPT_SANDBOXING = YES; + GCC_C_LANGUAGE_STANDARD = gnu17; + GCC_NO_COMMON_BLOCKS = YES; + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; + GCC_WARN_UNDECLARED_SELECTOR = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; + GCC_WARN_UNUSED_FUNCTION = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + IPHONEOS_DEPLOYMENT_TARGET = 18.2; + LOCALIZATION_PREFERS_STRING_CATALOGS = YES; + MTL_ENABLE_DEBUG_INFO = NO; + MTL_FAST_MATH = YES; + SDKROOT = iphoneos; + SWIFT_COMPILATION_MODE = wholemodule; + VALIDATE_PRODUCT = YES; + }; + name = Release; + }; + 842D54862DA712C200D3528B /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + ARCHS = ( + "$(ARCHS_STANDARD)", + arm64e, + ); + CLANG_ENABLE_MODULES = YES; + CODE_SIGN_STYLE = Automatic; + DEVELOPMENT_TEAM = 97JCY7859U; + IPHONEOS_DEPLOYMENT_TARGET = 13.0; + OTHER_LDFLAGS = "-ObjC"; + PRODUCT_NAME = "$(TARGET_NAME)"; + SKIP_INSTALL = YES; + SWIFT_OPTIMIZATION_LEVEL = "-Onone"; + SWIFT_VERSION = 5.0; + TARGETED_DEVICE_FAMILY = "1,2"; + }; + name = Debug; + }; + 842D54872DA712C200D3528B /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + ARCHS = ( + "$(ARCHS_STANDARD)", + arm64e, + ); + CLANG_ENABLE_MODULES = YES; + CODE_SIGN_STYLE = Automatic; + DEVELOPMENT_TEAM = 97JCY7859U; + IPHONEOS_DEPLOYMENT_TARGET = 13.0; + OTHER_LDFLAGS = "-ObjC"; + PRODUCT_NAME = "$(TARGET_NAME)"; + SKIP_INSTALL = YES; + SWIFT_VERSION = 5.0; + TARGETED_DEVICE_FAMILY = "1,2"; + }; + name = Release; + }; +/* End XCBuildConfiguration section */ + +/* Begin XCConfigurationList section */ + 842D54792DA712C200D3528B /* Build configuration list for PBXProject "SentrySampleShared" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 842D54832DA712C200D3528B /* Debug */, + 842D54842DA712C200D3528B /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + 842D54852DA712C200D3528B /* Build configuration list for PBXNativeTarget "SentrySampleShared-Swift" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 842D54862DA712C200D3528B /* Debug */, + 842D54872DA712C200D3528B /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; +/* End XCConfigurationList section */ + }; + rootObject = 842D54762DA712C200D3528B /* Project object */; +} From 3263cc3c51dd62e4b3ccfe8286e2fc93bfe216ff Mon Sep 17 00:00:00 2001 From: Andrew McKnight Date: Wed, 9 Apr 2025 13:03:06 -0800 Subject: [PATCH 10/35] ref: create shared lib for sample apps --- .../DSNStorage.swift | 13 +- .../GitInjections.swift | 23 ++ .../SentrySDKOverrides.swift | 0 .../SentrySDKWrapper.swift | 18 +- .../contents.xcworkspacedata | 7 + .../project.pbxproj | 299 ++++++++++++++++++ Samples/Shared/GitInjections.swift | 25 -- .../iOS-Swift.xcodeproj/project.pbxproj | 88 ++++-- Samples/iOS-Swift/iOS-Swift/AppDelegate.swift | 1 + .../iOS-Swift/ExtraViewController.swift | 1 + .../Profiling/ProfilingViewController.swift | 1 + .../Tools/DSNDisplayViewController.swift | 1 + .../iOS-Swift/iOS-SwiftClip/AppDelegate.swift | 3 +- 13 files changed, 413 insertions(+), 67 deletions(-) rename Samples/{iOS-Swift/iOS-Swift/Tools => SentrySampleShared-Swift/SentrySampleShared-Swift}/DSNStorage.swift (82%) create mode 100644 Samples/SentrySampleShared-Swift/SentrySampleShared-Swift/GitInjections.swift rename Samples/{iOS-Swift/iOS-Swift => SentrySampleShared-Swift/SentrySampleShared-Swift}/SentrySDKOverrides.swift (100%) rename Samples/{iOS-Swift/iOS-Swift => SentrySampleShared-Swift/SentrySampleShared-Swift}/SentrySDKWrapper.swift (98%) create mode 100644 Samples/SentrySampleShared-Swift/SentrySampleShared.xcodeproj/project.xcworkspace/contents.xcworkspacedata create mode 100644 Samples/SentrySampleShared/SentrySampleShared.xcodeproj/project.pbxproj delete mode 100644 Samples/Shared/GitInjections.swift diff --git a/Samples/iOS-Swift/iOS-Swift/Tools/DSNStorage.swift b/Samples/SentrySampleShared-Swift/SentrySampleShared-Swift/DSNStorage.swift similarity index 82% rename from Samples/iOS-Swift/iOS-Swift/Tools/DSNStorage.swift rename to Samples/SentrySampleShared-Swift/SentrySampleShared-Swift/DSNStorage.swift index 0680b4831fe..6ed4ff98825 100644 --- a/Samples/iOS-Swift/iOS-Swift/Tools/DSNStorage.swift +++ b/Samples/SentrySampleShared-Swift/SentrySampleShared-Swift/DSNStorage.swift @@ -4,10 +4,9 @@ import Sentry /** * Stores the DSN to a file in the cache directory. */ -class DSNStorage { - - static let shared = DSNStorage() - +public class DSNStorage { + public static let shared = DSNStorage() + private let dsnFile: URL private init() { @@ -17,12 +16,12 @@ class DSNStorage { dsnFile = cachesDirectory.appendingPathComponent("dsn") } - func saveDSN(dsn: String) throws { + public func saveDSN(dsn: String) throws { try deleteDSN() try dsn.write(to: dsnFile, atomically: true, encoding: .utf8) } - func getDSN() throws -> String? { + public func getDSN() throws -> String? { let fileManager = FileManager.default guard fileManager.fileExists(atPath: dsnFile.path) else { @@ -32,7 +31,7 @@ class DSNStorage { return try String(contentsOfFile: dsnFile.path) } - func deleteDSN() throws { + public func deleteDSN() throws { let fileManager = FileManager.default if fileManager.fileExists(atPath: dsnFile.path) { try fileManager.removeItem(at: dsnFile) diff --git a/Samples/SentrySampleShared-Swift/SentrySampleShared-Swift/GitInjections.swift b/Samples/SentrySampleShared-Swift/SentrySampleShared-Swift/GitInjections.swift new file mode 100644 index 00000000000..9c1d681c99b --- /dev/null +++ b/Samples/SentrySampleShared-Swift/SentrySampleShared-Swift/GitInjections.swift @@ -0,0 +1,23 @@ +import Foundation +import Sentry + +extension Bundle { + var gitCommitHash: String? { + infoDictionary?["GIT_COMMIT_HASH"] as? String + } + var gitBranchName: String? { + infoDictionary?["GIT_BRANCH"] as? String + } + var gitStatusClean: Bool { + (infoDictionary?["GIT_STATUS_CLEAN"] as? String) == "1" + } +} + +public func injectGitInformation(scope: Scope) { + if let commitHash = Bundle.main.gitCommitHash { + scope.setTag(value: "\(commitHash)\(Bundle.main.gitStatusClean ? "" : "-dirty")", key: "git-commit-hash") + } + if let branchName = Bundle.main.gitBranchName { + scope.setTag(value: branchName, key: "git-branch-name") + } +} diff --git a/Samples/iOS-Swift/iOS-Swift/SentrySDKOverrides.swift b/Samples/SentrySampleShared-Swift/SentrySampleShared-Swift/SentrySDKOverrides.swift similarity index 100% rename from Samples/iOS-Swift/iOS-Swift/SentrySDKOverrides.swift rename to Samples/SentrySampleShared-Swift/SentrySampleShared-Swift/SentrySDKOverrides.swift diff --git a/Samples/iOS-Swift/iOS-Swift/SentrySDKWrapper.swift b/Samples/SentrySampleShared-Swift/SentrySampleShared-Swift/SentrySDKWrapper.swift similarity index 98% rename from Samples/iOS-Swift/iOS-Swift/SentrySDKWrapper.swift rename to Samples/SentrySampleShared-Swift/SentrySampleShared-Swift/SentrySDKWrapper.swift index 6ef85ba0c30..95947798bc3 100644 --- a/Samples/iOS-Swift/iOS-Swift/SentrySDKWrapper.swift +++ b/Samples/SentrySampleShared-Swift/SentrySampleShared-Swift/SentrySDKWrapper.swift @@ -3,10 +3,10 @@ import Sentry import UIKit -struct SentrySDKWrapper { - static let shared = SentrySDKWrapper() - - func startSentry() { +public struct SentrySDKWrapper { + public static let shared = SentrySDKWrapper() + + public func startSentry() { SentrySDK.start(configureOptions: configureSentryOptions(options:)) } @@ -118,9 +118,9 @@ struct SentrySDKWrapper { } scope.setTag(value: "swift", key: "language") - - scope.injectGitInformation() - + + injectGitInformation(scope: scope) + let user = User(userId: "1") user.email = self.env["--io.sentry.user.email"] ?? "tony@example.com" user.username = username @@ -339,8 +339,8 @@ extension SentrySDKWrapper { // MARK: Convenience access to SDK configuration via launch arg / environment variable extension SentrySDKWrapper { - static let defaultDSN = "https://6cc9bae94def43cab8444a99e0031c28@o447951.ingest.sentry.io/5428557" - + public static let defaultDSN = "https://6cc9bae94def43cab8444a99e0031c28@o447951.ingest.sentry.io/5428557" + var args: [String] { let args = ProcessInfo.processInfo.arguments print("[iOS-Swift] [debug] launch arguments: \(args)") diff --git a/Samples/SentrySampleShared-Swift/SentrySampleShared.xcodeproj/project.xcworkspace/contents.xcworkspacedata b/Samples/SentrySampleShared-Swift/SentrySampleShared.xcodeproj/project.xcworkspace/contents.xcworkspacedata new file mode 100644 index 00000000000..919434a6254 --- /dev/null +++ b/Samples/SentrySampleShared-Swift/SentrySampleShared.xcodeproj/project.xcworkspace/contents.xcworkspacedata @@ -0,0 +1,7 @@ + + + + + diff --git a/Samples/SentrySampleShared/SentrySampleShared.xcodeproj/project.pbxproj b/Samples/SentrySampleShared/SentrySampleShared.xcodeproj/project.pbxproj new file mode 100644 index 00000000000..c43c19937e2 --- /dev/null +++ b/Samples/SentrySampleShared/SentrySampleShared.xcodeproj/project.pbxproj @@ -0,0 +1,299 @@ +// !$*UTF8*$! +{ + archiveVersion = 1; + classes = { + }; + objectVersion = 77; + objects = { + +/* Begin PBXCopyFilesBuildPhase section */ + 842D53192DA702C400D3528B /* CopyFiles */ = { + isa = PBXCopyFilesBuildPhase; + buildActionMask = 2147483647; + dstPath = "include/$(PRODUCT_NAME)"; + dstSubfolderSpec = 16; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXCopyFilesBuildPhase section */ + +/* Begin PBXFileReference section */ + 842D531B2DA702C400D3528B /* libSentrySampleShared.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libSentrySampleShared.a; sourceTree = BUILT_PRODUCTS_DIR; }; +/* End PBXFileReference section */ + +/* Begin PBXFileSystemSynchronizedRootGroup section */ + 842D531D2DA702C400D3528B /* SentrySampleShared */ = { + isa = PBXFileSystemSynchronizedRootGroup; + path = SentrySampleShared; + sourceTree = ""; + }; +/* End PBXFileSystemSynchronizedRootGroup section */ + +/* Begin PBXFrameworksBuildPhase section */ + 842D53182DA702C400D3528B /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXFrameworksBuildPhase section */ + +/* Begin PBXGroup section */ + 842D53122DA702C400D3528B = { + isa = PBXGroup; + children = ( + 842D531D2DA702C400D3528B /* SentrySampleShared */, + 842D531C2DA702C400D3528B /* Products */, + ); + sourceTree = ""; + }; + 842D531C2DA702C400D3528B /* Products */ = { + isa = PBXGroup; + children = ( + 842D531B2DA702C400D3528B /* libSentrySampleShared.a */, + ); + name = Products; + sourceTree = ""; + }; +/* End PBXGroup section */ + +/* Begin PBXNativeTarget section */ + 842D531A2DA702C400D3528B /* SentrySampleShared */ = { + isa = PBXNativeTarget; + buildConfigurationList = 842D53222DA702C400D3528B /* Build configuration list for PBXNativeTarget "SentrySampleShared" */; + buildPhases = ( + 842D53172DA702C400D3528B /* Sources */, + 842D53182DA702C400D3528B /* Frameworks */, + 842D53192DA702C400D3528B /* CopyFiles */, + ); + buildRules = ( + ); + dependencies = ( + ); + fileSystemSynchronizedGroups = ( + 842D531D2DA702C400D3528B /* SentrySampleShared */, + ); + name = SentrySampleShared; + packageProductDependencies = ( + ); + productName = SentrySampleShared; + productReference = 842D531B2DA702C400D3528B /* libSentrySampleShared.a */; + productType = "com.apple.product-type.library.static"; + }; +/* End PBXNativeTarget section */ + +/* Begin PBXProject section */ + 842D53132DA702C400D3528B /* Project object */ = { + isa = PBXProject; + attributes = { + BuildIndependentTargetsInParallel = 1; + LastSwiftUpdateCheck = 1620; + LastUpgradeCheck = 1620; + TargetAttributes = { + 842D531A2DA702C400D3528B = { + CreatedOnToolsVersion = 16.2; + }; + }; + }; + buildConfigurationList = 842D53162DA702C400D3528B /* Build configuration list for PBXProject "SentrySampleShared" */; + developmentRegion = en; + hasScannedForEncodings = 0; + knownRegions = ( + en, + Base, + ); + mainGroup = 842D53122DA702C400D3528B; + minimizedProjectReferenceProxies = 1; + preferredProjectObjectVersion = 77; + productRefGroup = 842D531C2DA702C400D3528B /* Products */; + projectDirPath = ""; + projectRoot = ""; + targets = ( + 842D531A2DA702C400D3528B /* SentrySampleShared */, + ); + }; +/* End PBXProject section */ + +/* Begin PBXSourcesBuildPhase section */ + 842D53172DA702C400D3528B /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXSourcesBuildPhase section */ + +/* Begin XCBuildConfiguration section */ + 842D53202DA702C400D3528B /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + ASSETCATALOG_COMPILER_GENERATE_SWIFT_ASSET_SYMBOL_EXTENSIONS = YES; + CLANG_ANALYZER_NONNULL = YES; + CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++20"; + CLANG_ENABLE_MODULES = YES; + CLANG_ENABLE_OBJC_ARC = YES; + CLANG_ENABLE_OBJC_WEAK = YES; + CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_COMMA = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; + CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; + CLANG_WARN_DOCUMENTATION_COMMENTS = YES; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INFINITE_RECURSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; + CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; + CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; + CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES; + CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; + CLANG_WARN_STRICT_PROTOTYPES = YES; + CLANG_WARN_SUSPICIOUS_MOVE = YES; + CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; + CLANG_WARN_UNREACHABLE_CODE = YES; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + COPY_PHASE_STRIP = NO; + DEBUG_INFORMATION_FORMAT = dwarf; + ENABLE_STRICT_OBJC_MSGSEND = YES; + ENABLE_TESTABILITY = YES; + ENABLE_USER_SCRIPT_SANDBOXING = YES; + GCC_C_LANGUAGE_STANDARD = gnu17; + GCC_DYNAMIC_NO_PIC = NO; + GCC_NO_COMMON_BLOCKS = YES; + GCC_OPTIMIZATION_LEVEL = 0; + GCC_PREPROCESSOR_DEFINITIONS = ( + "DEBUG=1", + "$(inherited)", + ); + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; + GCC_WARN_UNDECLARED_SELECTOR = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; + GCC_WARN_UNUSED_FUNCTION = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + IPHONEOS_DEPLOYMENT_TARGET = 18.2; + LOCALIZATION_PREFERS_STRING_CATALOGS = YES; + MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE; + MTL_FAST_MATH = YES; + ONLY_ACTIVE_ARCH = YES; + SDKROOT = iphoneos; + SWIFT_ACTIVE_COMPILATION_CONDITIONS = "DEBUG $(inherited)"; + SWIFT_OPTIMIZATION_LEVEL = "-Onone"; + }; + name = Debug; + }; + 842D53212DA702C400D3528B /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + ASSETCATALOG_COMPILER_GENERATE_SWIFT_ASSET_SYMBOL_EXTENSIONS = YES; + CLANG_ANALYZER_NONNULL = YES; + CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++20"; + CLANG_ENABLE_MODULES = YES; + CLANG_ENABLE_OBJC_ARC = YES; + CLANG_ENABLE_OBJC_WEAK = YES; + CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_COMMA = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; + CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; + CLANG_WARN_DOCUMENTATION_COMMENTS = YES; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INFINITE_RECURSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; + CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; + CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; + CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES; + CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; + CLANG_WARN_STRICT_PROTOTYPES = YES; + CLANG_WARN_SUSPICIOUS_MOVE = YES; + CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; + CLANG_WARN_UNREACHABLE_CODE = YES; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + COPY_PHASE_STRIP = NO; + DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; + ENABLE_NS_ASSERTIONS = NO; + ENABLE_STRICT_OBJC_MSGSEND = YES; + ENABLE_USER_SCRIPT_SANDBOXING = YES; + GCC_C_LANGUAGE_STANDARD = gnu17; + GCC_NO_COMMON_BLOCKS = YES; + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; + GCC_WARN_UNDECLARED_SELECTOR = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; + GCC_WARN_UNUSED_FUNCTION = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + IPHONEOS_DEPLOYMENT_TARGET = 18.2; + LOCALIZATION_PREFERS_STRING_CATALOGS = YES; + MTL_ENABLE_DEBUG_INFO = NO; + MTL_FAST_MATH = YES; + SDKROOT = iphoneos; + SWIFT_COMPILATION_MODE = wholemodule; + VALIDATE_PRODUCT = YES; + }; + name = Release; + }; + 842D53232DA702C400D3528B /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + CODE_SIGN_STYLE = Automatic; + DEVELOPMENT_TEAM = 97JCY7859U; + OTHER_LDFLAGS = "-ObjC"; + PRODUCT_NAME = "$(TARGET_NAME)"; + SKIP_INSTALL = YES; + SWIFT_VERSION = 5.0; + TARGETED_DEVICE_FAMILY = "1,2"; + }; + name = Debug; + }; + 842D53242DA702C400D3528B /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + CODE_SIGN_STYLE = Automatic; + DEVELOPMENT_TEAM = 97JCY7859U; + OTHER_LDFLAGS = "-ObjC"; + PRODUCT_NAME = "$(TARGET_NAME)"; + SKIP_INSTALL = YES; + SWIFT_VERSION = 5.0; + TARGETED_DEVICE_FAMILY = "1,2"; + }; + name = Release; + }; +/* End XCBuildConfiguration section */ + +/* Begin XCConfigurationList section */ + 842D53162DA702C400D3528B /* Build configuration list for PBXProject "SentrySampleShared" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 842D53202DA702C400D3528B /* Debug */, + 842D53212DA702C400D3528B /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + 842D53222DA702C400D3528B /* Build configuration list for PBXNativeTarget "SentrySampleShared" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 842D53232DA702C400D3528B /* Debug */, + 842D53242DA702C400D3528B /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; +/* End XCConfigurationList section */ + }; + rootObject = 842D53132DA702C400D3528B /* Project object */; +} diff --git a/Samples/Shared/GitInjections.swift b/Samples/Shared/GitInjections.swift deleted file mode 100644 index ab36e5892ed..00000000000 --- a/Samples/Shared/GitInjections.swift +++ /dev/null @@ -1,25 +0,0 @@ -import Foundation -import Sentry - -extension Bundle { - var gitCommitHash: String? { - infoDictionary?["GIT_COMMIT_HASH"] as? String - } - var gitBranchName: String? { - infoDictionary?["GIT_BRANCH"] as? String - } - var gitStatusClean: Bool { - (infoDictionary?["GIT_STATUS_CLEAN"] as? String) == "1" - } -} - -extension Scope { - @objc public func injectGitInformation() { - if let commitHash = Bundle.main.gitCommitHash { - setTag(value: "\(commitHash)\(Bundle.main.gitStatusClean ? "" : "-dirty")", key: "git-commit-hash") - } - if let branchName = Bundle.main.gitBranchName { - setTag(value: branchName, key: "git-branch-name") - } - } -} diff --git a/Samples/iOS-Swift/iOS-Swift.xcodeproj/project.pbxproj b/Samples/iOS-Swift/iOS-Swift.xcodeproj/project.pbxproj index d53ec1d7c95..87d00ac2ca8 100644 --- a/Samples/iOS-Swift/iOS-Swift.xcodeproj/project.pbxproj +++ b/Samples/iOS-Swift/iOS-Swift.xcodeproj/project.pbxproj @@ -24,8 +24,8 @@ 7B79000429028C7300A7F467 /* MetricKitManager.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7B79000329028C7300A7F467 /* MetricKitManager.swift */; }; 7BFC8B0626D4D24B000D3504 /* LoremIpsum.txt in Resources */ = {isa = PBXBuildFile; fileRef = 7BFC8B0526D4D24B000D3504 /* LoremIpsum.txt */; }; 840DDB2A2D9EFD49000C17F7 /* BenchmarkingViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 840DDB292D9EFD49000C17F7 /* BenchmarkingViewController.swift */; }; - 840DDB2C2D9F02CB000C17F7 /* SentrySDKOverrides.swift in Sources */ = {isa = PBXBuildFile; fileRef = 840DDB2B2D9F02CB000C17F7 /* SentrySDKOverrides.swift */; }; - 840DDB2D2D9F02CB000C17F7 /* SentrySDKOverrides.swift in Sources */ = {isa = PBXBuildFile; fileRef = 840DDB2B2D9F02CB000C17F7 /* SentrySDKOverrides.swift */; }; + 842D54AA2DA7135F00D3528B /* libSentrySampleShared-Swift.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 842D549F2DA712ED00D3528B /* libSentrySampleShared-Swift.a */; }; + 842D54AD2DA7138700D3528B /* libSentrySampleShared-Swift.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 842D549F2DA712ED00D3528B /* libSentrySampleShared-Swift.a */; }; 841C8A202DA7266E00DCA74F /* FeaturesViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 841C8A1F2DA7266E00DCA74F /* FeaturesViewController.swift */; }; 841C8A212DA7266E00DCA74F /* FeaturesViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 841C8A1F2DA7266E00DCA74F /* FeaturesViewController.swift */; }; 841C8A232DA7273400DCA74F /* LaunchArgumentTableViewCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 841C8A222DA7273400DCA74F /* LaunchArgumentTableViewCell.swift */; }; @@ -48,14 +48,9 @@ 84BA71F12C8BC55A0045B828 /* Toasts.swift in Sources */ = {isa = PBXBuildFile; fileRef = 84BA71F02C8BC55A0045B828 /* Toasts.swift */; }; 84BA71F22C8F73FD0045B828 /* DSNDisplayViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 84BA71E32C8BBBEC0045B828 /* DSNDisplayViewController.swift */; }; 84BA71F32C8F74080045B828 /* Toasts.swift in Sources */ = {isa = PBXBuildFile; fileRef = 84BA71F02C8BC55A0045B828 /* Toasts.swift */; }; - 84BA72A72C93698E0045B828 /* GitInjections.swift in Sources */ = {isa = PBXBuildFile; fileRef = 84BA72A52C93698E0045B828 /* GitInjections.swift */; }; - 84BA72A82C93698E0045B828 /* GitInjections.swift in Sources */ = {isa = PBXBuildFile; fileRef = 84BA72A52C93698E0045B828 /* GitInjections.swift */; }; - 84BA72DE2C9391920045B828 /* GitInjections.swift in Sources */ = {isa = PBXBuildFile; fileRef = 84BA72A52C93698E0045B828 /* GitInjections.swift */; }; 84BE546F287503F100ACC735 /* SentrySDKPerformanceBenchmarkTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 84BE546E287503F100ACC735 /* SentrySDKPerformanceBenchmarkTests.m */; }; 84BE547E287645B900ACC735 /* SentryProcessInfo.m in Sources */ = {isa = PBXBuildFile; fileRef = 84BE54792876451D00ACC735 /* SentryProcessInfo.m */; }; 84DBC6252CE6D321000C4904 /* UserFeedbackUITests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 84DBC61F2CE6D31C000C4904 /* UserFeedbackUITests.swift */; }; - 84EEE6632D28B35700010A9D /* SentrySDKWrapper.swift in Sources */ = {isa = PBXBuildFile; fileRef = 84EEE6612D28B35700010A9D /* SentrySDKWrapper.swift */; }; - 84EEE6642D2CABF500010A9D /* SentrySDKWrapper.swift in Sources */ = {isa = PBXBuildFile; fileRef = 84EEE6612D28B35700010A9D /* SentrySDKWrapper.swift */; }; 84FB812A284001B800F3A94A /* SentryBenchmarking.mm in Sources */ = {isa = PBXBuildFile; fileRef = 84FB8129284001B800F3A94A /* SentryBenchmarking.mm */; }; 84FB812B284001B800F3A94A /* SentryBenchmarking.mm in Sources */ = {isa = PBXBuildFile; fileRef = 84FB8129284001B800F3A94A /* SentryBenchmarking.mm */; }; 8E8C57AF25EF16E6001CEEFA /* TraceTestViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8E8C57AE25EF16E6001CEEFA /* TraceTestViewController.swift */; }; @@ -125,8 +120,6 @@ D8DBDA76274D591F00007380 /* TableViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = D8DBDA75274D591F00007380 /* TableViewController.swift */; }; D8DBDA78274D5FC400007380 /* SplitViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = D8DBDA77274D5FC400007380 /* SplitViewController.swift */; }; D8F01DEA2A1376B5008F4996 /* InfoForBreadcrumbController.swift in Sources */ = {isa = PBXBuildFile; fileRef = D8F01DE92A1376B5008F4996 /* InfoForBreadcrumbController.swift */; }; - D8F3D052274E572F00B56F8C /* DSNStorage.swift in Sources */ = {isa = PBXBuildFile; fileRef = D8F3D04F274E572F00B56F8C /* DSNStorage.swift */; }; - D8F3D053274E572F00B56F8C /* DSNStorage.swift in Sources */ = {isa = PBXBuildFile; fileRef = D8F3D04F274E572F00B56F8C /* DSNStorage.swift */; }; D8F3D054274E572F00B56F8C /* RandomErrors.swift in Sources */ = {isa = PBXBuildFile; fileRef = D8F3D051274E572F00B56F8C /* RandomErrors.swift */; }; D8F3D055274E572F00B56F8C /* RandomErrors.swift in Sources */ = {isa = PBXBuildFile; fileRef = D8F3D051274E572F00B56F8C /* RandomErrors.swift */; }; D8F3D057274E574200B56F8C /* LoremIpsumViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = D8F3D056274E574200B56F8C /* LoremIpsumViewController.swift */; }; @@ -153,6 +146,27 @@ remoteGlobalIDString = 637AFDA5243B02760034958B; remoteInfo = "iOS-Swift"; }; + 842D549E2DA712ED00D3528B /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = 842D54882DA712E700D3528B /* SentrySampleShared.xcodeproj */; + proxyType = 2; + remoteGlobalIDString = 842D547E2DA712C200D3528B; + remoteInfo = "SentrySampleShared-Swift"; + }; + 842D54A82DA7135A00D3528B /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = 842D54882DA712E700D3528B /* SentrySampleShared.xcodeproj */; + proxyType = 1; + remoteGlobalIDString = 842D547D2DA712C200D3528B; + remoteInfo = "SentrySampleShared-Swift"; + }; + 842D54AB2DA7138400D3528B /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = 842D54882DA712E700D3528B /* SentrySampleShared.xcodeproj */; + proxyType = 1; + remoteGlobalIDString = 842D547D2DA712C200D3528B; + remoteInfo = "SentrySampleShared-Swift"; + }; 848A2564286E3351008A8858 /* PBXContainerItemProxy */ = { isa = PBXContainerItemProxy; containerPortal = 637AFD9E243B02760034958B /* Project object */; @@ -284,7 +298,7 @@ 7B79000329028C7300A7F467 /* MetricKitManager.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MetricKitManager.swift; sourceTree = ""; }; 7BFC8B0526D4D24B000D3504 /* LoremIpsum.txt */ = {isa = PBXFileReference; lastKnownFileType = text; path = LoremIpsum.txt; sourceTree = ""; }; 840DDB292D9EFD49000C17F7 /* BenchmarkingViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = BenchmarkingViewController.swift; sourceTree = ""; }; - 840DDB2B2D9F02CB000C17F7 /* SentrySDKOverrides.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SentrySDKOverrides.swift; sourceTree = ""; }; + 842D54882DA712E700D3528B /* SentrySampleShared.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = SentrySampleShared.xcodeproj; path = "../SentrySampleShared-Swift/SentrySampleShared.xcodeproj"; sourceTree = SOURCE_ROOT; }; 841C8A1F2DA7266E00DCA74F /* FeaturesViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = FeaturesViewController.swift; sourceTree = ""; }; 841C8A222DA7273400DCA74F /* LaunchArgumentTableViewCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LaunchArgumentTableViewCell.swift; sourceTree = ""; }; 841C8A252DA7273E00DCA74F /* EnvironmentVariableTableViewCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = EnvironmentVariableTableViewCell.swift; sourceTree = ""; }; @@ -303,12 +317,10 @@ 84B527BC28DD25E400475E8D /* SentryDevice.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; name = SentryDevice.mm; path = ../../../Sources/Sentry/SentryDevice.mm; sourceTree = ""; }; 84BA71E32C8BBBEC0045B828 /* DSNDisplayViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DSNDisplayViewController.swift; sourceTree = ""; }; 84BA71F02C8BC55A0045B828 /* Toasts.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Toasts.swift; sourceTree = ""; }; - 84BA72A52C93698E0045B828 /* GitInjections.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = GitInjections.swift; sourceTree = ""; }; 84BE546E287503F100ACC735 /* SentrySDKPerformanceBenchmarkTests.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = SentrySDKPerformanceBenchmarkTests.m; sourceTree = ""; }; 84BE54782876451D00ACC735 /* SentryProcessInfo.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = SentryProcessInfo.h; sourceTree = ""; }; 84BE54792876451D00ACC735 /* SentryProcessInfo.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = SentryProcessInfo.m; sourceTree = ""; }; 84DBC61F2CE6D31C000C4904 /* UserFeedbackUITests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = UserFeedbackUITests.swift; sourceTree = ""; }; - 84EEE6612D28B35700010A9D /* SentrySDKWrapper.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SentrySDKWrapper.swift; sourceTree = ""; }; 84FB8125284001B800F3A94A /* SentryBenchmarking.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = SentryBenchmarking.h; sourceTree = ""; }; 84FB8129284001B800F3A94A /* SentryBenchmarking.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; path = SentryBenchmarking.mm; sourceTree = ""; }; 84FB812C2840021B00F3A94A /* iOS-Swift-Bridging-Header.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "iOS-Swift-Bridging-Header.h"; sourceTree = ""; }; @@ -361,7 +373,6 @@ D8DBDA77274D5FC400007380 /* SplitViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SplitViewController.swift; sourceTree = ""; }; D8F01DE92A1376B5008F4996 /* InfoForBreadcrumbController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = InfoForBreadcrumbController.swift; sourceTree = ""; }; D8F01DF02A1377D0008F4996 /* SentryExposure.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = SentryExposure.h; sourceTree = ""; }; - D8F3D04F274E572F00B56F8C /* DSNStorage.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = DSNStorage.swift; sourceTree = ""; }; D8F3D051274E572F00B56F8C /* RandomErrors.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = RandomErrors.swift; sourceTree = ""; }; D8F3D056274E574200B56F8C /* LoremIpsumViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = LoremIpsumViewController.swift; sourceTree = ""; }; D8F3D05E274E6A8B00B56F8C /* AssertView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AssertView.swift; sourceTree = ""; }; @@ -385,6 +396,7 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( + 842D54AA2DA7135F00D3528B /* libSentrySampleShared-Swift.a in Frameworks */, D86B9C972CDD11430039211C /* Sentry.framework in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; @@ -416,6 +428,7 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( + 842D54AD2DA7138700D3528B /* libSentrySampleShared-Swift.a in Frameworks */, D86B9C9D2CDD115A0039211C /* Sentry.framework in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; @@ -461,6 +474,7 @@ 637AFD9D243B02760034958B = { isa = PBXGroup; children = ( + 842D54882DA712E700D3528B /* SentrySampleShared.xcodeproj */, 62C97DB92CC69B0200DDA204 /* SampleAssets.xcassets */, 84BA72A62C93698E0045B828 /* Shared */, 848A2576286E3490008A8858 /* PerformanceBenchmarks */, @@ -502,8 +516,6 @@ D8DBDA73274D4DF900007380 /* ViewControllers */, 63F93AA9245AC91600A500DB /* iOS-Swift.entitlements */, 637AFDA9243B02760034958B /* AppDelegate.swift */, - 84EEE6612D28B35700010A9D /* SentrySDKWrapper.swift */, - 840DDB2B2D9F02CB000C17F7 /* SentrySDKOverrides.swift */, 637AFDAD243B02760034958B /* TransactionsViewController.swift */, 84AB90782A50031B0054C99A /* Profiling */, D80D021229EE93630084393D /* ErrorsViewController.swift */, @@ -541,6 +553,14 @@ path = "iOS-Swift-UITests"; sourceTree = ""; }; + 842D549B2DA712ED00D3528B /* Products */ = { + isa = PBXGroup; + children = ( + 842D549F2DA712ED00D3528B /* libSentrySampleShared-Swift.a */, + ); + name = Products; + sourceTree = ""; + }; 848A2576286E3490008A8858 /* PerformanceBenchmarks */ = { isa = PBXGroup; children = ( @@ -568,7 +588,6 @@ 84BA72A62C93698E0045B828 /* Shared */ = { isa = PBXGroup; children = ( - 84BA72A52C93698E0045B828 /* GitInjections.swift */, 849C4A682D66CA1600FA632D /* screenshot.png */, ); name = Shared; @@ -643,7 +662,6 @@ D8832B122AF4F7FE00C522B0 /* TopViewControllerInspector.swift */, 84FB8125284001B800F3A94A /* SentryBenchmarking.h */, 84FB8129284001B800F3A94A /* SentryBenchmarking.mm */, - D8F3D04F274E572F00B56F8C /* DSNStorage.swift */, D8F3D051274E572F00B56F8C /* RandomErrors.swift */, D8D7BB492750067900044146 /* UIAssert.swift */, D8D7BB4D27501B9400044146 /* SpanObserver.swift */, @@ -716,6 +734,7 @@ buildRules = ( ); dependencies = ( + 842D54A92DA7135A00D3528B /* PBXTargetDependency */, D840D533273A07F600CDF142 /* PBXTargetDependency */, ); name = "iOS-Swift"; @@ -801,6 +820,7 @@ buildRules = ( ); dependencies = ( + 842D54AC2DA7138400D3528B /* PBXTargetDependency */, ); name = "iOS-SwiftClip"; productName = "iOS-SwiftClip"; @@ -914,6 +934,12 @@ ); productRefGroup = 637AFDA7243B02760034958B /* Products */; projectDirPath = ""; + projectReferences = ( + { + ProductGroup = 842D549B2DA712ED00D3528B /* Products */; + ProjectRef = 842D54882DA712E700D3528B /* SentrySampleShared.xcodeproj */; + }, + ); projectRoot = ""; targets = ( 637AFDA5243B02760034958B /* iOS-Swift */, @@ -928,6 +954,16 @@ }; /* End PBXProject section */ +/* Begin PBXReferenceProxy section */ + 842D549F2DA712ED00D3528B /* libSentrySampleShared-Swift.a */ = { + isa = PBXReferenceProxy; + fileType = archive.ar; + path = "libSentrySampleShared-Swift.a"; + remoteRef = 842D549E2DA712ED00D3528B /* PBXContainerItemProxy */; + sourceTree = BUILT_PRODUCTS_DIR; + }; +/* End PBXReferenceProxy section */ + /* Begin PBXResourcesBuildPhase section */ 637AFDA4243B02760034958B /* Resources */ = { isa = PBXResourcesBuildPhase; @@ -1136,14 +1172,12 @@ 0AABE2EA28855FF80057ED69 /* PermissionsViewController.swift in Sources */, 84BA71E42C8BBBEC0045B828 /* DSNDisplayViewController.swift in Sources */, 7B5525B32938B5B5006A2932 /* DiskWriteException.swift in Sources */, - 84BA72A72C93698E0045B828 /* GitInjections.swift in Sources */, D8F3D062274EBD4800B56F8C /* SpanExtension.swift in Sources */, 637AFDAA243B02760034958B /* AppDelegate.swift in Sources */, D8F57BC527BBD787000D09D4 /* CoreDataViewController.swift in Sources */, D8D7BB4E27501B9400044146 /* SpanObserver.swift in Sources */, D8F01DEA2A1376B5008F4996 /* InfoForBreadcrumbController.swift in Sources */, D8832B1E2AF52D0500C522B0 /* PageViewController.swift in Sources */, - 840DDB2C2D9F02CB000C17F7 /* SentrySDKOverrides.swift in Sources */, D8DBDA76274D591F00007380 /* TableViewController.swift in Sources */, D8C33E1F29FBB1F70071B75A /* UIEventBreadcrumbsController.swift in Sources */, 8E8C57AF25EF16E6001CEEFA /* TraceTestViewController.swift in Sources */, @@ -1153,7 +1187,6 @@ 84FB812A284001B800F3A94A /* SentryBenchmarking.mm in Sources */, 84ACC4432A73CD0700932A18 /* ProfilingCPUWork.swift in Sources */, 847670302BAA4AFA001A4E31 /* NSObject+SentryAppSetup.m in Sources */, - D8F3D052274E572F00B56F8C /* DSNStorage.swift in Sources */, D8F3D054274E572F00B56F8C /* RandomErrors.swift in Sources */, 841C8A232DA7273400DCA74F /* LaunchArgumentTableViewCell.swift in Sources */, D80D021329EE93630084393D /* ErrorsViewController.swift in Sources */, @@ -1213,19 +1246,15 @@ D8269A4E274C09A400BD5BD5 /* SwiftUIViewController.swift in Sources */, D8269A4F274C09A400BD5BD5 /* SwiftUIView.swift in Sources */, D8444E57275F795D0042F4DE /* UIViewControllerExtension.swift in Sources */, - 84BA72A82C93698E0045B828 /* GitInjections.swift in Sources */, - 840DDB2D2D9F02CB000C17F7 /* SentrySDKOverrides.swift in Sources */, 924857562C89A86300774AC3 /* MainViewController.swift in Sources */, D8F3D058274E57D600B56F8C /* TableViewController.swift in Sources */, 7B5525B62938B644006A2932 /* DiskWriteException.swift in Sources */, - 84EEE6642D2CABF500010A9D /* SentrySDKWrapper.swift in Sources */, D8269A58274C0FC700BD5BD5 /* TransactionsViewController.swift in Sources */, 844DA821282584C300E6B62E /* CoreDataViewController.swift in Sources */, D8444E55275F79570042F4DE /* SpanExtension.swift in Sources */, D8832B1F2AF535B200C522B0 /* PageViewController.swift in Sources */, D8444E51275F79240042F4DE /* AssertView.swift in Sources */, 844DA822282584F700E6B62E /* SentryData.xcdatamodeld in Sources */, - D8F3D053274E572F00B56F8C /* DSNStorage.swift in Sources */, 84FB812B284001B800F3A94A /* SentryBenchmarking.mm in Sources */, D8F3D055274E572F00B56F8C /* RandomErrors.swift in Sources */, 0AAAB8572887F7C60011845C /* PermissionsViewController.swift in Sources */, @@ -1246,7 +1275,6 @@ isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; files = ( - 84BA72DE2C9391920045B828 /* GitInjections.swift in Sources */, D840D527273A07F400CDF142 /* ViewController.swift in Sources */, D840D523273A07F400CDF142 /* AppDelegate.swift in Sources */, D840D525273A07F400CDF142 /* SceneDelegate.swift in Sources */, @@ -1287,6 +1315,16 @@ target = 637AFDA5243B02760034958B /* iOS-Swift */; targetProxy = 7B64386D26A6C544000D0F65 /* PBXContainerItemProxy */; }; + 842D54A92DA7135A00D3528B /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + name = "SentrySampleShared-Swift"; + targetProxy = 842D54A82DA7135A00D3528B /* PBXContainerItemProxy */; + }; + 842D54AC2DA7138400D3528B /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + name = "SentrySampleShared-Swift"; + targetProxy = 842D54AB2DA7138400D3528B /* PBXContainerItemProxy */; + }; 848A2563286E3351008A8858 /* PBXTargetDependency */ = { isa = PBXTargetDependency; target = 637AFDA5243B02760034958B /* iOS-Swift */; diff --git a/Samples/iOS-Swift/iOS-Swift/AppDelegate.swift b/Samples/iOS-Swift/iOS-Swift/AppDelegate.swift index 2a68fb41113..54ba787270f 100644 --- a/Samples/iOS-Swift/iOS-Swift/AppDelegate.swift +++ b/Samples/iOS-Swift/iOS-Swift/AppDelegate.swift @@ -1,3 +1,4 @@ +import SentrySampleShared_Swift import UIKit @UIApplicationMain diff --git a/Samples/iOS-Swift/iOS-Swift/ExtraViewController.swift b/Samples/iOS-Swift/iOS-Swift/ExtraViewController.swift index e84f9265128..f7691ec4111 100644 --- a/Samples/iOS-Swift/iOS-Swift/ExtraViewController.swift +++ b/Samples/iOS-Swift/iOS-Swift/ExtraViewController.swift @@ -1,5 +1,6 @@ import Foundation import Sentry +import SentrySampleShared_Swift import UIKit class ExtraViewController: UIViewController { diff --git a/Samples/iOS-Swift/iOS-Swift/Profiling/ProfilingViewController.swift b/Samples/iOS-Swift/iOS-Swift/Profiling/ProfilingViewController.swift index 549bbbf88c2..e4c80fdbe70 100644 --- a/Samples/iOS-Swift/iOS-Swift/Profiling/ProfilingViewController.swift +++ b/Samples/iOS-Swift/iOS-Swift/Profiling/ProfilingViewController.swift @@ -1,4 +1,5 @@ import Sentry +import SentrySampleShared_Swift import UIKit class ProfilingViewController: UIViewController, UITextFieldDelegate { diff --git a/Samples/iOS-Swift/iOS-Swift/Tools/DSNDisplayViewController.swift b/Samples/iOS-Swift/iOS-Swift/Tools/DSNDisplayViewController.swift index adeec5511e5..7f9cba8a165 100644 --- a/Samples/iOS-Swift/iOS-Swift/Tools/DSNDisplayViewController.swift +++ b/Samples/iOS-Swift/iOS-Swift/Tools/DSNDisplayViewController.swift @@ -1,3 +1,4 @@ +import SentrySampleShared_Swift import UIKit let fontSize: CGFloat = 12 diff --git a/Samples/iOS-Swift/iOS-SwiftClip/AppDelegate.swift b/Samples/iOS-Swift/iOS-SwiftClip/AppDelegate.swift index 472ffdce40e..48555756d26 100644 --- a/Samples/iOS-Swift/iOS-SwiftClip/AppDelegate.swift +++ b/Samples/iOS-Swift/iOS-SwiftClip/AppDelegate.swift @@ -1,4 +1,5 @@ import Sentry +import SentrySampleShared_Swift import UIKit @main @@ -16,7 +17,7 @@ class AppDelegate: UIResponder, UIApplicationDelegate { options.tracesSampleRate = 1.0 options.sessionTrackingIntervalMillis = 5_000 options.initialScope = { scope in - scope.injectGitInformation() + injectGitInformation(scope: scope) return scope } From 648adf53853645769e7b0696c96056350749c354 Mon Sep 17 00:00:00 2001 From: Andrew McKnight Date: Wed, 9 Apr 2025 13:03:33 -0800 Subject: [PATCH 11/35] use in iOS13-Swift --- .../iOS-Swift.xcodeproj/project.pbxproj | 15 +++++++ .../iOS-Swift/iOS13-Swift/AppDelegate.swift | 45 +------------------ 2 files changed, 17 insertions(+), 43 deletions(-) diff --git a/Samples/iOS-Swift/iOS-Swift.xcodeproj/project.pbxproj b/Samples/iOS-Swift/iOS-Swift.xcodeproj/project.pbxproj index 87d00ac2ca8..db60474a41f 100644 --- a/Samples/iOS-Swift/iOS-Swift.xcodeproj/project.pbxproj +++ b/Samples/iOS-Swift/iOS-Swift.xcodeproj/project.pbxproj @@ -27,6 +27,7 @@ 842D54AA2DA7135F00D3528B /* libSentrySampleShared-Swift.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 842D549F2DA712ED00D3528B /* libSentrySampleShared-Swift.a */; }; 842D54AD2DA7138700D3528B /* libSentrySampleShared-Swift.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 842D549F2DA712ED00D3528B /* libSentrySampleShared-Swift.a */; }; 841C8A202DA7266E00DCA74F /* FeaturesViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 841C8A1F2DA7266E00DCA74F /* FeaturesViewController.swift */; }; + 842D54B12DA7169800D3528B /* libSentrySampleShared-Swift.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 842D549F2DA712ED00D3528B /* libSentrySampleShared-Swift.a */; }; 841C8A212DA7266E00DCA74F /* FeaturesViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 841C8A1F2DA7266E00DCA74F /* FeaturesViewController.swift */; }; 841C8A232DA7273400DCA74F /* LaunchArgumentTableViewCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 841C8A222DA7273400DCA74F /* LaunchArgumentTableViewCell.swift */; }; 841C8A242DA7273400DCA74F /* LaunchArgumentTableViewCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 841C8A222DA7273400DCA74F /* LaunchArgumentTableViewCell.swift */; }; @@ -167,6 +168,13 @@ remoteGlobalIDString = 842D547D2DA712C200D3528B; remoteInfo = "SentrySampleShared-Swift"; }; + 842D54B22DA7169B00D3528B /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = 842D54882DA712E700D3528B /* SentrySampleShared.xcodeproj */; + proxyType = 1; + remoteGlobalIDString = 842D547D2DA712C200D3528B; + remoteInfo = "SentrySampleShared-Swift"; + }; 848A2564286E3351008A8858 /* PBXContainerItemProxy */ = { isa = PBXContainerItemProxy; containerPortal = 637AFD9E243B02760034958B /* Project object */; @@ -419,6 +427,7 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( + 842D54B12DA7169800D3528B /* libSentrySampleShared-Swift.a in Frameworks */, D86B9C9A2CDD114E0039211C /* Sentry.framework in Frameworks */, D86B9CA32CDD136A0039211C /* SentrySwiftUI.framework in Frameworks */, ); @@ -798,6 +807,7 @@ buildRules = ( ); dependencies = ( + 842D54B32DA7169B00D3528B /* PBXTargetDependency */, ); name = "iOS13-Swift"; packageProductDependencies = ( @@ -1325,6 +1335,11 @@ name = "SentrySampleShared-Swift"; targetProxy = 842D54AB2DA7138400D3528B /* PBXContainerItemProxy */; }; + 842D54B32DA7169B00D3528B /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + name = "SentrySampleShared-Swift"; + targetProxy = 842D54B22DA7169B00D3528B /* PBXContainerItemProxy */; + }; 848A2563286E3351008A8858 /* PBXTargetDependency */ = { isa = PBXTargetDependency; target = 637AFDA5243B02760034958B /* iOS-Swift */; diff --git a/Samples/iOS-Swift/iOS13-Swift/AppDelegate.swift b/Samples/iOS-Swift/iOS13-Swift/AppDelegate.swift index e863beb72cb..1a54ecfd14d 100644 --- a/Samples/iOS-Swift/iOS13-Swift/AppDelegate.swift +++ b/Samples/iOS-Swift/iOS13-Swift/AppDelegate.swift @@ -1,52 +1,11 @@ import Sentry +import SentrySampleShared_Swift import UIKit @main class AppDelegate: UIResponder, UIApplicationDelegate { - - static let defaultDSN = "https://6cc9bae94def43cab8444a99e0031c28@o447951.ingest.sentry.io/5428557" - - 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. - var storedDsn: String? - do { - 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 - if #available(iOS 15.0, *) { - options.enableMetricKit = true - } - // Sampling 100% - In Production you probably want to adjust this - options.tracesSampleRate = 1.0 - options.sessionTrackingIntervalMillis = 5_000 - options.profilesSampleRate = 1.0 - options.attachScreenshot = true - options.attachViewHierarchy = true - options.environment = "test-app" - options.enableTimeToFullDisplayTracing = true - options.initialScope = { scope in - scope.injectGitInformation() - return scope - } - - // Experimental features - options.experimental.enableFileManagerSwizzling = true - options.sessionReplay.enableExperimentalViewRenderer = true - // Disable the fast view renderering, because we noticed parts (like the tab bar) are not rendered correctly - options.sessionReplay.enableFastViewRendering = false - } - } - func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool { - startSentry() + SentrySDKWrapper.shared.startSentry() return true } From 968fc41cbc82c72410b41e79f550b5e08f4e164f Mon Sep 17 00:00:00 2001 From: Andrew McKnight Date: Wed, 9 Apr 2025 13:06:42 -0800 Subject: [PATCH 12/35] use in iOS-SwiftUI --- .../iOS-SwiftUI.xcodeproj/project.pbxproj | 67 ++++++++++++++++--- .../iOS-SwiftUI/iOS-SwiftUI/SwiftUIApp.swift | 19 +----- 2 files changed, 59 insertions(+), 27 deletions(-) diff --git a/Samples/iOS-SwiftUI/iOS-SwiftUI.xcodeproj/project.pbxproj b/Samples/iOS-SwiftUI/iOS-SwiftUI.xcodeproj/project.pbxproj index fd4c9d5e589..37aa847d484 100644 --- a/Samples/iOS-SwiftUI/iOS-SwiftUI.xcodeproj/project.pbxproj +++ b/Samples/iOS-SwiftUI/iOS-SwiftUI.xcodeproj/project.pbxproj @@ -15,7 +15,7 @@ 7BB6224F26A56C4E00D0E75E /* ContentView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7BB6224E26A56C4E00D0E75E /* ContentView.swift */; }; 7BB6225426A56C5000D0E75E /* Preview Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 7BB6225326A56C5000D0E75E /* Preview Assets.xcassets */; }; 7BB6225E26A56CB600D0E75E /* Sentry.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 7BB6225C26A56CB600D0E75E /* Sentry.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; }; - 84BA72B52C9369C80045B828 /* GitInjections.swift in Sources */ = {isa = PBXBuildFile; fileRef = 84BA72B32C9369C80045B828 /* GitInjections.swift */; }; + 842D55132DA7186B00D3528B /* libSentrySampleShared-Swift.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 842D55122DA7186800D3528B /* libSentrySampleShared-Swift.a */; }; 84D4FEB528ECD53500EDAAFE /* Sentry.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 84D4FEB228ECD52E00EDAAFE /* Sentry.framework */; }; D8199DCD29376FD90074249E /* SentrySwiftUI.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = D8BBD38B2901AE400011F850 /* SentrySwiftUI.framework */; }; D8199DCE29376FD90074249E /* SentrySwiftUI.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = D8BBD38B2901AE400011F850 /* SentrySwiftUI.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; }; @@ -96,6 +96,27 @@ remoteGlobalIDString = D84DAD4D2B17428D003CF120; remoteInfo = SentryTestUtilsDynamic; }; + 842D55062DA7184E00D3528B /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = 84D4FEAA28ECD52E00EDAAFE /* Sentry.xcodeproj */; + proxyType = 2; + remoteGlobalIDString = D833D7342D1321C100961E7A; + remoteInfo = SentrySwiftUITests; + }; + 842D550E2DA7186800D3528B /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = 842D550B2DA7186800D3528B /* SentrySampleShared.xcodeproj */; + proxyType = 1; + remoteGlobalIDString = 842D547D2DA712C200D3528B; + remoteInfo = "SentrySampleShared-Swift"; + }; + 842D55112DA7186800D3528B /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = 842D550B2DA7186800D3528B /* SentrySampleShared.xcodeproj */; + proxyType = 2; + remoteGlobalIDString = 842D547E2DA712C200D3528B; + remoteInfo = "SentrySampleShared-Swift"; + }; 84D4FEB128ECD52E00EDAAFE /* PBXContainerItemProxy */ = { isa = PBXContainerItemProxy; containerPortal = 84D4FEAA28ECD52E00EDAAFE /* Sentry.xcodeproj */; @@ -167,7 +188,8 @@ 7BB6225C26A56CB600D0E75E /* Sentry.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; path = Sentry.framework; sourceTree = BUILT_PRODUCTS_DIR; }; 7BB6226026A56E1E00D0E75E /* iOS-SwiftUI.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = "iOS-SwiftUI.entitlements"; sourceTree = ""; }; 8425DE1A2B52241000113FEF /* SentryProfilingConditionals.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = SentryProfilingConditionals.h; path = ../../../../Sources/Sentry/Public/SentryProfilingConditionals.h; sourceTree = ""; }; - 84BA72B32C9369C80045B828 /* GitInjections.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = GitInjections.swift; sourceTree = ""; }; + 842D55082DA7185400D3528B /* SentrySampleShared.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = SentrySampleShared.xcodeproj; path = "../SentrySampleShared-Swift/SentrySampleShared.xcodeproj"; sourceTree = SOURCE_ROOT; }; + 842D550B2DA7186800D3528B /* SentrySampleShared.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = SentrySampleShared.xcodeproj; path = "/Users/andrewmcknight/Code/organization/getsentry/repos/public/sentry-cocoa/Samples/SentrySampleShared-Swift/SentrySampleShared.xcodeproj"; sourceTree = ""; }; 84D4FEA628ECD51800EDAAFE /* Sentry.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; path = Sentry.framework; sourceTree = BUILT_PRODUCTS_DIR; }; 84D4FEA828ECD52700EDAAFE /* Sentry.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = Sentry.xcodeproj; path = ../../Sentry.xcodeproj; sourceTree = ""; }; 84D4FEAA28ECD52E00EDAAFE /* Sentry.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = Sentry.xcodeproj; path = "/Users/andrewmcknight/Code/organization/getsentry/repos/public/sentry-cocoa/Sentry.xcodeproj"; sourceTree = ""; }; @@ -194,6 +216,7 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( + 842D55132DA7186B00D3528B /* libSentrySampleShared-Swift.a in Frameworks */, 84D4FEB528ECD53500EDAAFE /* Sentry.framework in Frameworks */, D8199DCD29376FD90074249E /* SentrySwiftUI.framework in Frameworks */, ); @@ -211,7 +234,7 @@ 8425DE232B52241000113FEF /* SentryProfilerTests.xctest */, 8425DE252B52241000113FEF /* libSentryTestUtils.a */, 8425DE272B52241000113FEF /* SentryTestUtilsDynamic.framework */, - D833D61B2D13216300961E7A /* libSentrySwiftUITests.a */, + D833D61B2D13216300961E7A /* SentrySwiftUITests.xctest */, ); name = Products; sourceTree = ""; @@ -228,12 +251,13 @@ 7BB6224026A56C4E00D0E75E = { isa = PBXGroup; children = ( - 84BA72B42C9369C80045B828 /* Shared */, + 842D55082DA7185400D3528B /* SentrySampleShared.xcodeproj */, 7BB6224B26A56C4E00D0E75E /* iOS-SwiftUI */, 7B64385826A6C0A6000D0F65 /* iOS-SwiftUI-UITests */, 7BB6224A26A56C4E00D0E75E /* Products */, 7BB6225B26A56CB600D0E75E /* Frameworks */, 84D4FEAA28ECD52E00EDAAFE /* Sentry.xcodeproj */, + 842D550B2DA7186800D3528B /* SentrySampleShared.xcodeproj */, ); sourceTree = ""; }; @@ -283,13 +307,12 @@ name = Frameworks; sourceTree = ""; }; - 84BA72B42C9369C80045B828 /* Shared */ = { + 842D550C2DA7186800D3528B /* Products */ = { isa = PBXGroup; children = ( - 84BA72B32C9369C80045B828 /* GitInjections.swift */, + 842D55122DA7186800D3528B /* libSentrySampleShared-Swift.a */, ); - name = Shared; - path = ../Shared; + name = Products; sourceTree = ""; }; 84D4FEAB28ECD52E00EDAAFE /* Products */ = { @@ -301,6 +324,7 @@ 8425DE342B52241000113FEF /* SentryProfilerTests.xctest */, 8425DE362B52241000113FEF /* libSentryTestUtils.a */, 8425DE382B52241000113FEF /* SentryTestUtilsDynamic.framework */, + 842D55072DA7184E00D3528B /* SentrySwiftUITests.xctest */, ); name = Products; sourceTree = ""; @@ -354,6 +378,7 @@ buildRules = ( ); dependencies = ( + 842D550F2DA7186800D3528B /* PBXTargetDependency */, ); name = "iOS-SwiftUI"; productName = "iOS-SwiftUI"; @@ -398,6 +423,10 @@ ProductGroup = 84D4FEAB28ECD52E00EDAAFE /* Products */; ProjectRef = 84D4FEAA28ECD52E00EDAAFE /* Sentry.xcodeproj */; }, + { + ProductGroup = 842D550C2DA7186800D3528B /* Products */; + ProjectRef = 842D550B2DA7186800D3528B /* SentrySampleShared.xcodeproj */; + }, ); projectRoot = ""; targets = ( @@ -471,6 +500,20 @@ remoteRef = 8425DE372B52241000113FEF /* PBXContainerItemProxy */; sourceTree = BUILT_PRODUCTS_DIR; }; + 842D55072DA7184E00D3528B /* SentrySwiftUITests.xctest */ = { + isa = PBXReferenceProxy; + fileType = wrapper.cfbundle; + path = SentrySwiftUITests.xctest; + remoteRef = 842D55062DA7184E00D3528B /* PBXContainerItemProxy */; + sourceTree = BUILT_PRODUCTS_DIR; + }; + 842D55122DA7186800D3528B /* libSentrySampleShared-Swift.a */ = { + isa = PBXReferenceProxy; + fileType = archive.ar; + path = "libSentrySampleShared-Swift.a"; + remoteRef = 842D55112DA7186800D3528B /* PBXContainerItemProxy */; + sourceTree = BUILT_PRODUCTS_DIR; + }; 84D4FEB228ECD52E00EDAAFE /* Sentry.framework */ = { isa = PBXReferenceProxy; fileType = wrapper.framework; @@ -485,7 +528,7 @@ remoteRef = 84D4FEB328ECD52E00EDAAFE /* PBXContainerItemProxy */; sourceTree = BUILT_PRODUCTS_DIR; }; - D833D61B2D13216300961E7A /* libSentrySwiftUITests.a */ = { + D833D61B2D13216300961E7A /* SentrySwiftUITests.xctest */ = { isa = PBXReferenceProxy; fileType = wrapper.cfbundle; path = SentrySwiftUITests.xctest; @@ -577,7 +620,6 @@ 7BB6224F26A56C4E00D0E75E /* ContentView.swift in Sources */, 7B5DA9D92859DC850069AD02 /* LoremIpsumView.swift in Sources */, D832FAF02982A908007A9A5F /* FormScreen.swift in Sources */, - 84BA72B52C9369C80045B828 /* GitInjections.swift in Sources */, 7BB6224D26A56C4E00D0E75E /* SwiftUIApp.swift in Sources */, ); runOnlyForDeploymentPostprocessing = 0; @@ -590,6 +632,11 @@ target = 7BB6224826A56C4E00D0E75E /* iOS-SwiftUI */; targetProxy = 7B64385C26A6C0A6000D0F65 /* PBXContainerItemProxy */; }; + 842D550F2DA7186800D3528B /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + name = "SentrySampleShared-Swift"; + targetProxy = 842D550E2DA7186800D3528B /* PBXContainerItemProxy */; + }; /* End PBXTargetDependency section */ /* Begin XCBuildConfiguration section */ diff --git a/Samples/iOS-SwiftUI/iOS-SwiftUI/SwiftUIApp.swift b/Samples/iOS-SwiftUI/iOS-SwiftUI/SwiftUIApp.swift index 2795e225717..dc45bdda927 100644 --- a/Samples/iOS-SwiftUI/iOS-SwiftUI/SwiftUIApp.swift +++ b/Samples/iOS-SwiftUI/iOS-SwiftUI/SwiftUIApp.swift @@ -1,27 +1,12 @@ import Foundation import Sentry +import SentrySampleShared_Swift import SwiftUI @main struct SwiftUIApp: App { init() { - SentrySDK.start { options in - options.dsn = "https://6cc9bae94def43cab8444a99e0031c28@o447951.ingest.sentry.io/5428557" - options.debug = true - options.tracesSampleRate = 1.0 - options.profilesSampleRate = 1.0 - options.sessionReplay.sessionSampleRate = 1.0 - options.initialScope = { scope in - scope.injectGitInformation() - return scope - } - - // Experimental features - options.experimental.enableFileManagerSwizzling = true - options.sessionReplay.enableExperimentalViewRenderer = true - // Disable the fast view renderering, because we noticed parts (like the tab bar) are not rendered correctly - options.sessionReplay.enableFastViewRendering = false - } + SentrySDKWrapper.shared.startSentry() } var body: some Scene { From 078639aafa1aa6577e6140a4f108939661c198d7 Mon Sep 17 00:00:00 2001 From: Andrew McKnight Date: Wed, 9 Apr 2025 13:09:08 -0800 Subject: [PATCH 13/35] use in iOS15-SwiftUI --- .../iOS15-SwiftUI.xcodeproj/project.pbxproj | 58 +++++++++++++++++++ Samples/iOS15-SwiftUI/iOS15-SwiftUI/App.swift | 14 +---- 2 files changed, 60 insertions(+), 12 deletions(-) diff --git a/Samples/iOS15-SwiftUI/iOS15-SwiftUI.xcodeproj/project.pbxproj b/Samples/iOS15-SwiftUI/iOS15-SwiftUI.xcodeproj/project.pbxproj index ace047825ed..55121b50076 100644 --- a/Samples/iOS15-SwiftUI/iOS15-SwiftUI.xcodeproj/project.pbxproj +++ b/Samples/iOS15-SwiftUI/iOS15-SwiftUI.xcodeproj/project.pbxproj @@ -13,8 +13,26 @@ 7B5166532758C6F400C0A720 /* Preview Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 7B5166522758C6F400C0A720 /* Preview Assets.xcassets */; }; 7B5166772758C72600C0A720 /* Sentry.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 7B5166762758C72600C0A720 /* Sentry.framework */; }; 7B5166782758C72600C0A720 /* Sentry.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 7B5166762758C72600C0A720 /* Sentry.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; }; + 842D55182DA718FB00D3528B /* libSentrySampleShared-Swift.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 842D55172DA718FB00D3528B /* libSentrySampleShared-Swift.a */; }; /* End PBXBuildFile section */ +/* Begin PBXContainerItemProxy section */ + 842D551C2DA718FE00D3528B /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = 842D55192DA718FE00D3528B /* SentrySampleShared.xcodeproj */; + proxyType = 1; + remoteGlobalIDString = 842D547D2DA712C200D3528B; + remoteInfo = "SentrySampleShared-Swift"; + }; + 842D551F2DA718FF00D3528B /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = 842D55192DA718FE00D3528B /* SentrySampleShared.xcodeproj */; + proxyType = 2; + remoteGlobalIDString = 842D547E2DA712C200D3528B; + remoteInfo = "SentrySampleShared-Swift"; + }; +/* End PBXContainerItemProxy section */ + /* Begin PBXCopyFilesBuildPhase section */ 7B5166792758C72600C0A720 /* Embed Frameworks */ = { isa = PBXCopyFilesBuildPhase; @@ -36,6 +54,9 @@ 7B51664D2758C6F000C0A720 /* ContentView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ContentView.swift; sourceTree = ""; }; 7B5166522758C6F400C0A720 /* Preview Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = "Preview Assets.xcassets"; sourceTree = ""; }; 7B5166762758C72600C0A720 /* Sentry.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; path = Sentry.framework; sourceTree = BUILT_PRODUCTS_DIR; }; + 842D55142DA718F200D3528B /* SentrySampleShared.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = SentrySampleShared.xcodeproj; path = "../SentrySampleShared-Swift/SentrySampleShared.xcodeproj"; sourceTree = SOURCE_ROOT; }; + 842D55172DA718FB00D3528B /* libSentrySampleShared-Swift.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; path = "libSentrySampleShared-Swift.a"; sourceTree = BUILT_PRODUCTS_DIR; }; + 842D55192DA718FE00D3528B /* SentrySampleShared.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = SentrySampleShared.xcodeproj; path = "/Users/andrewmcknight/Code/organization/getsentry/repos/public/sentry-cocoa/Samples/SentrySampleShared-Swift/SentrySampleShared.xcodeproj"; sourceTree = ""; }; /* End PBXFileReference section */ /* Begin PBXFrameworksBuildPhase section */ @@ -43,6 +64,7 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( + 842D55182DA718FB00D3528B /* libSentrySampleShared-Swift.a in Frameworks */, 7B5166772758C72600C0A720 /* Sentry.framework in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; @@ -53,9 +75,11 @@ 7B51663F2758C6F000C0A720 = { isa = PBXGroup; children = ( + 842D55142DA718F200D3528B /* SentrySampleShared.xcodeproj */, 7B51664A2758C6F000C0A720 /* iOS15-SwiftUI */, 7B5166492758C6F000C0A720 /* Products */, 7B5166752758C72600C0A720 /* Frameworks */, + 842D55192DA718FE00D3528B /* SentrySampleShared.xcodeproj */, ); sourceTree = ""; }; @@ -89,11 +113,20 @@ 7B5166752758C72600C0A720 /* Frameworks */ = { isa = PBXGroup; children = ( + 842D55172DA718FB00D3528B /* libSentrySampleShared-Swift.a */, 7B5166762758C72600C0A720 /* Sentry.framework */, ); name = Frameworks; sourceTree = ""; }; + 842D551A2DA718FE00D3528B /* Products */ = { + isa = PBXGroup; + children = ( + 842D55202DA718FF00D3528B /* libSentrySampleShared-Swift.a */, + ); + name = Products; + sourceTree = ""; + }; /* End PBXGroup section */ /* Begin PBXNativeTarget section */ @@ -109,6 +142,7 @@ buildRules = ( ); dependencies = ( + 842D551D2DA718FE00D3528B /* PBXTargetDependency */, ); name = "iOS15-SwiftUI"; productName = "iOS15-SwiftUI"; @@ -141,6 +175,12 @@ mainGroup = 7B51663F2758C6F000C0A720; productRefGroup = 7B5166492758C6F000C0A720 /* Products */; projectDirPath = ""; + projectReferences = ( + { + ProductGroup = 842D551A2DA718FE00D3528B /* Products */; + ProjectRef = 842D55192DA718FE00D3528B /* SentrySampleShared.xcodeproj */; + }, + ); projectRoot = ""; targets = ( 7B5166472758C6F000C0A720 /* iOS15-SwiftUI */, @@ -148,6 +188,16 @@ }; /* End PBXProject section */ +/* Begin PBXReferenceProxy section */ + 842D55202DA718FF00D3528B /* libSentrySampleShared-Swift.a */ = { + isa = PBXReferenceProxy; + fileType = archive.ar; + path = "libSentrySampleShared-Swift.a"; + remoteRef = 842D551F2DA718FF00D3528B /* PBXContainerItemProxy */; + sourceTree = BUILT_PRODUCTS_DIR; + }; +/* End PBXReferenceProxy section */ + /* Begin PBXResourcesBuildPhase section */ 7B5166462758C6F000C0A720 /* Resources */ = { isa = PBXResourcesBuildPhase; @@ -172,6 +222,14 @@ }; /* End PBXSourcesBuildPhase section */ +/* Begin PBXTargetDependency section */ + 842D551D2DA718FE00D3528B /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + name = "SentrySampleShared-Swift"; + targetProxy = 842D551C2DA718FE00D3528B /* PBXContainerItemProxy */; + }; +/* End PBXTargetDependency section */ + /* Begin XCBuildConfiguration section */ 7B51666A2758C6F400C0A720 /* Debug */ = { isa = XCBuildConfiguration; diff --git a/Samples/iOS15-SwiftUI/iOS15-SwiftUI/App.swift b/Samples/iOS15-SwiftUI/iOS15-SwiftUI/App.swift index ea341cdcf25..d457b9079b0 100644 --- a/Samples/iOS15-SwiftUI/iOS15-SwiftUI/App.swift +++ b/Samples/iOS15-SwiftUI/iOS15-SwiftUI/App.swift @@ -1,21 +1,11 @@ import Sentry +import SentrySampleShared_Swift import SwiftUI @main struct SwiftUIApp: App { init() { - SentrySDK.start { options in - options.dsn = "https://6cc9bae94def43cab8444a99e0031c28@o447951.ingest.sentry.io/5428557" - options.debug = true - options.tracesSampleRate = 1.0 - options.profilesSampleRate = 1.0 - - // Experimental features - options.experimental.enableFileManagerSwizzling = true - options.sessionReplay.enableExperimentalViewRenderer = true - // Disable the fast view renderering, because we noticed parts (like the tab bar) are not rendered correctly - options.sessionReplay.enableFastViewRendering = false - } + SentrySDKWrapper.shared.startSentry() } var body: some Scene { From fdcf250af10469340bd8440c96e0922b6fb0cdd6 Mon Sep 17 00:00:00 2001 From: Andrew McKnight Date: Wed, 9 Apr 2025 13:59:52 -0800 Subject: [PATCH 14/35] xcode insists on making this change automatically --- .../iOS15-SwiftUI.xcodeproj/project.pbxproj | 26 +++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/Samples/iOS15-SwiftUI/iOS15-SwiftUI.xcodeproj/project.pbxproj b/Samples/iOS15-SwiftUI/iOS15-SwiftUI.xcodeproj/project.pbxproj index 55121b50076..4ac23f51e5b 100644 --- a/Samples/iOS15-SwiftUI/iOS15-SwiftUI.xcodeproj/project.pbxproj +++ b/Samples/iOS15-SwiftUI/iOS15-SwiftUI.xcodeproj/project.pbxproj @@ -17,6 +17,13 @@ /* End PBXBuildFile section */ /* Begin PBXContainerItemProxy section */ + 841C8A192DA7253800DCA74F /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = 842D55142DA718F200D3528B /* SentrySampleShared.xcodeproj */; + proxyType = 2; + remoteGlobalIDString = 842D547E2DA712C200D3528B; + remoteInfo = "SentrySampleShared-Swift"; + }; 842D551C2DA718FE00D3528B /* PBXContainerItemProxy */ = { isa = PBXContainerItemProxy; containerPortal = 842D55192DA718FE00D3528B /* SentrySampleShared.xcodeproj */; @@ -119,6 +126,14 @@ name = Frameworks; sourceTree = ""; }; + 841C8A092DA7253800DCA74F /* Products */ = { + isa = PBXGroup; + children = ( + 841C8A1A2DA7253800DCA74F /* libSentrySampleShared-Swift.a */, + ); + name = Products; + sourceTree = ""; + }; 842D551A2DA718FE00D3528B /* Products */ = { isa = PBXGroup; children = ( @@ -180,6 +195,10 @@ ProductGroup = 842D551A2DA718FE00D3528B /* Products */; ProjectRef = 842D55192DA718FE00D3528B /* SentrySampleShared.xcodeproj */; }, + { + ProductGroup = 841C8A092DA7253800DCA74F /* Products */; + ProjectRef = 842D55142DA718F200D3528B /* SentrySampleShared.xcodeproj */; + }, ); projectRoot = ""; targets = ( @@ -189,6 +208,13 @@ /* End PBXProject section */ /* Begin PBXReferenceProxy section */ + 841C8A1A2DA7253800DCA74F /* libSentrySampleShared-Swift.a */ = { + isa = PBXReferenceProxy; + fileType = archive.ar; + path = "libSentrySampleShared-Swift.a"; + remoteRef = 841C8A192DA7253800DCA74F /* PBXContainerItemProxy */; + sourceTree = BUILT_PRODUCTS_DIR; + }; 842D55202DA718FF00D3528B /* libSentrySampleShared-Swift.a */ = { isa = PBXReferenceProxy; fileType = archive.ar; From dd4c4cbdc42c3d81bbff2a475294ba00bd2bec39 Mon Sep 17 00:00:00 2001 From: Andrew McKnight Date: Wed, 9 Apr 2025 16:01:52 -0800 Subject: [PATCH 15/35] add to iOS-Swift6 and fix a couple build errors after rebasing to get new override updates --- Samples/iOS-Swift/iOS-Swift.xcodeproj/project.pbxproj | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/Samples/iOS-Swift/iOS-Swift.xcodeproj/project.pbxproj b/Samples/iOS-Swift/iOS-Swift.xcodeproj/project.pbxproj index db60474a41f..47d974838b6 100644 --- a/Samples/iOS-Swift/iOS-Swift.xcodeproj/project.pbxproj +++ b/Samples/iOS-Swift/iOS-Swift.xcodeproj/project.pbxproj @@ -24,15 +24,15 @@ 7B79000429028C7300A7F467 /* MetricKitManager.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7B79000329028C7300A7F467 /* MetricKitManager.swift */; }; 7BFC8B0626D4D24B000D3504 /* LoremIpsum.txt in Resources */ = {isa = PBXBuildFile; fileRef = 7BFC8B0526D4D24B000D3504 /* LoremIpsum.txt */; }; 840DDB2A2D9EFD49000C17F7 /* BenchmarkingViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 840DDB292D9EFD49000C17F7 /* BenchmarkingViewController.swift */; }; - 842D54AA2DA7135F00D3528B /* libSentrySampleShared-Swift.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 842D549F2DA712ED00D3528B /* libSentrySampleShared-Swift.a */; }; - 842D54AD2DA7138700D3528B /* libSentrySampleShared-Swift.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 842D549F2DA712ED00D3528B /* libSentrySampleShared-Swift.a */; }; 841C8A202DA7266E00DCA74F /* FeaturesViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 841C8A1F2DA7266E00DCA74F /* FeaturesViewController.swift */; }; - 842D54B12DA7169800D3528B /* libSentrySampleShared-Swift.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 842D549F2DA712ED00D3528B /* libSentrySampleShared-Swift.a */; }; 841C8A212DA7266E00DCA74F /* FeaturesViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 841C8A1F2DA7266E00DCA74F /* FeaturesViewController.swift */; }; 841C8A232DA7273400DCA74F /* LaunchArgumentTableViewCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 841C8A222DA7273400DCA74F /* LaunchArgumentTableViewCell.swift */; }; 841C8A242DA7273400DCA74F /* LaunchArgumentTableViewCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 841C8A222DA7273400DCA74F /* LaunchArgumentTableViewCell.swift */; }; 841C8A262DA7273E00DCA74F /* EnvironmentVariableTableViewCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 841C8A252DA7273E00DCA74F /* EnvironmentVariableTableViewCell.swift */; }; 841C8A272DA7273E00DCA74F /* EnvironmentVariableTableViewCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 841C8A252DA7273E00DCA74F /* EnvironmentVariableTableViewCell.swift */; }; + 842D54AA2DA7135F00D3528B /* libSentrySampleShared-Swift.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 842D549F2DA712ED00D3528B /* libSentrySampleShared-Swift.a */; }; + 842D54AD2DA7138700D3528B /* libSentrySampleShared-Swift.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 842D549F2DA712ED00D3528B /* libSentrySampleShared-Swift.a */; }; + 842D54B12DA7169800D3528B /* libSentrySampleShared-Swift.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 842D549F2DA712ED00D3528B /* libSentrySampleShared-Swift.a */; }; 844DA821282584C300E6B62E /* CoreDataViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = D8F57BC427BBD787000D09D4 /* CoreDataViewController.swift */; }; 844DA822282584F700E6B62E /* SentryData.xcdatamodeld in Sources */ = {isa = PBXBuildFile; fileRef = D845F35927BAD4CC00A4D7A2 /* SentryData.xcdatamodeld */; }; 847670302BAA4AFA001A4E31 /* NSObject+SentryAppSetup.m in Sources */ = {isa = PBXBuildFile; fileRef = 8476702F2BAA4AFA001A4E31 /* NSObject+SentryAppSetup.m */; }; @@ -306,10 +306,10 @@ 7B79000329028C7300A7F467 /* MetricKitManager.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MetricKitManager.swift; sourceTree = ""; }; 7BFC8B0526D4D24B000D3504 /* LoremIpsum.txt */ = {isa = PBXFileReference; lastKnownFileType = text; path = LoremIpsum.txt; sourceTree = ""; }; 840DDB292D9EFD49000C17F7 /* BenchmarkingViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = BenchmarkingViewController.swift; sourceTree = ""; }; - 842D54882DA712E700D3528B /* SentrySampleShared.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = SentrySampleShared.xcodeproj; path = "../SentrySampleShared-Swift/SentrySampleShared.xcodeproj"; sourceTree = SOURCE_ROOT; }; 841C8A1F2DA7266E00DCA74F /* FeaturesViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = FeaturesViewController.swift; sourceTree = ""; }; 841C8A222DA7273400DCA74F /* LaunchArgumentTableViewCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LaunchArgumentTableViewCell.swift; sourceTree = ""; }; 841C8A252DA7273E00DCA74F /* EnvironmentVariableTableViewCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = EnvironmentVariableTableViewCell.swift; sourceTree = ""; }; + 842D54882DA712E700D3528B /* SentrySampleShared.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = SentrySampleShared.xcodeproj; path = "../SentrySampleShared-Swift/SentrySampleShared.xcodeproj"; sourceTree = SOURCE_ROOT; }; 8476702E2BAA4AFA001A4E31 /* NSObject+SentryAppSetup.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "NSObject+SentryAppSetup.h"; sourceTree = ""; }; 8476702F2BAA4AFA001A4E31 /* NSObject+SentryAppSetup.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = "NSObject+SentryAppSetup.m"; sourceTree = ""; }; 848A2573286E3351008A8858 /* PerformanceBenchmarks.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = PerformanceBenchmarks.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; @@ -1207,7 +1207,6 @@ 84BA71F12C8BC55A0045B828 /* Toasts.swift in Sources */, 629EC8AD2B0B537400858855 /* TriggerAppHang.swift in Sources */, D8AE48C92C57DC2F0092A2A6 /* WebViewController.swift in Sources */, - 84EEE6632D28B35700010A9D /* SentrySDKWrapper.swift in Sources */, 841C8A272DA7273E00DCA74F /* EnvironmentVariableTableViewCell.swift in Sources */, D8DBDA78274D5FC400007380 /* SplitViewController.swift in Sources */, 84ACC43C2A73CB5900932A18 /* ProfilingNetworkScanner.swift in Sources */, From 4c5f7bdf61e52cfdf571e448c0a811cb52a5dc1a Mon Sep 17 00:00:00 2001 From: Andrew McKnight Date: Wed, 9 Apr 2025 16:01:52 -0800 Subject: [PATCH 16/35] add to iOS-Swift6 and fix a couple build errors after rebasing to get new override updates --- .../SentrySDKOverrides.swift | 12 ++-- .../SentrySDKWrapper.swift | 20 ++++-- .../iOS-Swift.xcodeproj/project.pbxproj | 15 ++++ .../EnvironmentVariableTableViewCell.swift | 1 + .../iOS-Swift/FeaturesViewController.swift | 1 + .../LaunchArgumentTableViewCell.swift | 1 + .../iOS-Swift/iOS-Swift6/AppDelegate.swift | 42 +----------- .../iOS-SwiftUI.xcodeproj/project.pbxproj | 68 +++++++++---------- .../iOS15-SwiftUI.xcodeproj/project.pbxproj | 44 ------------ 9 files changed, 76 insertions(+), 128 deletions(-) diff --git a/Samples/SentrySampleShared-Swift/SentrySampleShared-Swift/SentrySDKOverrides.swift b/Samples/SentrySampleShared-Swift/SentrySampleShared-Swift/SentrySDKOverrides.swift index 03da9154eed..4956721afea 100644 --- a/Samples/SentrySampleShared-Swift/SentrySampleShared-Swift/SentrySDKOverrides.swift +++ b/Samples/SentrySampleShared-Swift/SentrySampleShared-Swift/SentrySDKOverrides.swift @@ -1,6 +1,6 @@ import Foundation -protocol SentrySDKOverride: RawRepresentable, CaseIterable { +public protocol SentrySDKOverride: RawRepresentable, CaseIterable { var boolValue: Bool { get set } var floatValue: Float? { get set } var stringValue: String? { get set } @@ -30,7 +30,7 @@ public enum SentrySDKOverrides { } } - enum Special: String, SentrySDKOverride { + public enum Special: String, SentrySDKOverride { case wipeDataOnLaunch = "--io.sentry.wipe-data" case disableEverything = "--io.sentry.disable-everything" @@ -44,7 +44,7 @@ public enum SentrySDKOverrides { } } - enum Feedback: String, SentrySDKOverride { + public enum Feedback: String, SentrySDKOverride { case allDefaults = "--io.sentry.feedback.all-defaults" case disableAutoInject = "--io.sentry.feedback.no-auto-inject-widget" case noWidgetText = "--io.sentry.feedback.no-widget-text" @@ -67,7 +67,7 @@ public enum SentrySDKOverrides { } } - enum Performance: String, SentrySDKOverride { + public enum Performance: String, SentrySDKOverride { case disableTimeToFullDisplayTracing = "--disable-time-to-full-display-tracing" case disablePerformanceV2 = "--disable-performance-v2" case disableAppHangTrackingV2 = "--disable-app-hang-tracking-v2" @@ -92,7 +92,7 @@ public enum SentrySDKOverrides { } } - enum Other: String, SentrySDKOverride { + public enum Other: String, SentrySDKOverride { case disableAttachScreenshot = "--disable-attach-screenshot" case disableAttachViewHierarchy = "--disable-attach-view-hierarchy" case disableSessionReplay = "--disable-session-replay" @@ -118,7 +118,7 @@ public enum SentrySDKOverrides { } } - var stringValue: String? { + public var stringValue: String? { get { switch self { case .userName, .userEmail: return getStringValueOverride(for: rawValue) diff --git a/Samples/SentrySampleShared-Swift/SentrySampleShared-Swift/SentrySDKWrapper.swift b/Samples/SentrySampleShared-Swift/SentrySampleShared-Swift/SentrySDKWrapper.swift index 95947798bc3..2817281a9db 100644 --- a/Samples/SentrySampleShared-Swift/SentrySampleShared-Swift/SentrySDKWrapper.swift +++ b/Samples/SentrySampleShared-Swift/SentrySampleShared-Swift/SentrySDKWrapper.swift @@ -12,10 +12,22 @@ public struct SentrySDKWrapper { func configureSentryOptions(options: Options) { options.dsn = dsn - options.beforeSend = { $0 } - options.beforeSendSpan = { $0 } - options.beforeCaptureScreenshot = { _ in true } - options.beforeCaptureViewHierarchy = { _ in true } + options.beforeSend = { + print("Sentry: beforeSend called") + return $0 + } + options.beforeSendSpan = { + print("Sentry: beforeSendSpan called") + return $0 + } + options.beforeCaptureScreenshot = { _ in + print("Sentry: beforeCaptureScreenshot called") + return true + } + options.beforeCaptureViewHierarchy = { _ in + print("Sentry: beforeCaptureViewHierarchy called") + return true + } options.debug = true if #available(iOS 16.0, *), !SentrySDKOverrides.Other.disableSessionReplay.boolValue { diff --git a/Samples/iOS-Swift/iOS-Swift.xcodeproj/project.pbxproj b/Samples/iOS-Swift/iOS-Swift.xcodeproj/project.pbxproj index 47d974838b6..73088f4c9e1 100644 --- a/Samples/iOS-Swift/iOS-Swift.xcodeproj/project.pbxproj +++ b/Samples/iOS-Swift/iOS-Swift.xcodeproj/project.pbxproj @@ -30,6 +30,7 @@ 841C8A242DA7273400DCA74F /* LaunchArgumentTableViewCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 841C8A222DA7273400DCA74F /* LaunchArgumentTableViewCell.swift */; }; 841C8A262DA7273E00DCA74F /* EnvironmentVariableTableViewCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 841C8A252DA7273E00DCA74F /* EnvironmentVariableTableViewCell.swift */; }; 841C8A272DA7273E00DCA74F /* EnvironmentVariableTableViewCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 841C8A252DA7273E00DCA74F /* EnvironmentVariableTableViewCell.swift */; }; + 841C8A5F2DA740D100DCA74F /* libSentrySampleShared-Swift.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 842D549F2DA712ED00D3528B /* libSentrySampleShared-Swift.a */; }; 842D54AA2DA7135F00D3528B /* libSentrySampleShared-Swift.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 842D549F2DA712ED00D3528B /* libSentrySampleShared-Swift.a */; }; 842D54AD2DA7138700D3528B /* libSentrySampleShared-Swift.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 842D549F2DA712ED00D3528B /* libSentrySampleShared-Swift.a */; }; 842D54B12DA7169800D3528B /* libSentrySampleShared-Swift.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 842D549F2DA712ED00D3528B /* libSentrySampleShared-Swift.a */; }; @@ -147,6 +148,13 @@ remoteGlobalIDString = 637AFDA5243B02760034958B; remoteInfo = "iOS-Swift"; }; + 841C8A602DA740D400DCA74F /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = 842D54882DA712E700D3528B /* SentrySampleShared.xcodeproj */; + proxyType = 1; + remoteGlobalIDString = 842D547D2DA712C200D3528B; + remoteInfo = "SentrySampleShared-Swift"; + }; 842D549E2DA712ED00D3528B /* PBXContainerItemProxy */ = { isa = PBXContainerItemProxy; containerPortal = 842D54882DA712E700D3528B /* SentrySampleShared.xcodeproj */; @@ -453,6 +461,7 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( + 841C8A5F2DA740D100DCA74F /* libSentrySampleShared-Swift.a in Frameworks */, D8F71A822CDD04C200334022 /* (null) in Frameworks */, D86B9CA02CDD11670039211C /* Sentry.framework in Frameworks */, ); @@ -867,6 +876,7 @@ buildRules = ( ); dependencies = ( + 841C8A612DA740D400DCA74F /* PBXTargetDependency */, ); name = "iOS-Swift6"; productName = "iOS-Swift6"; @@ -1324,6 +1334,11 @@ target = 637AFDA5243B02760034958B /* iOS-Swift */; targetProxy = 7B64386D26A6C544000D0F65 /* PBXContainerItemProxy */; }; + 841C8A612DA740D400DCA74F /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + name = "SentrySampleShared-Swift"; + targetProxy = 841C8A602DA740D400DCA74F /* PBXContainerItemProxy */; + }; 842D54A92DA7135A00D3528B /* PBXTargetDependency */ = { isa = PBXTargetDependency; name = "SentrySampleShared-Swift"; diff --git a/Samples/iOS-Swift/iOS-Swift/EnvironmentVariableTableViewCell.swift b/Samples/iOS-Swift/iOS-Swift/EnvironmentVariableTableViewCell.swift index f33f689d36c..18f6fd2cf93 100644 --- a/Samples/iOS-Swift/iOS-Swift/EnvironmentVariableTableViewCell.swift +++ b/Samples/iOS-Swift/iOS-Swift/EnvironmentVariableTableViewCell.swift @@ -1,3 +1,4 @@ +import SentrySampleShared_Swift import UIKit class EnvironmentVariableTableViewCell: UITableViewCell, UITextFieldDelegate { diff --git a/Samples/iOS-Swift/iOS-Swift/FeaturesViewController.swift b/Samples/iOS-Swift/iOS-Swift/FeaturesViewController.swift index 5ff6a92da9f..5227a16226c 100644 --- a/Samples/iOS-Swift/iOS-Swift/FeaturesViewController.swift +++ b/Samples/iOS-Swift/iOS-Swift/FeaturesViewController.swift @@ -1,3 +1,4 @@ +import SentrySampleShared_Swift import UIKit class FeaturesViewController: UITableViewController { diff --git a/Samples/iOS-Swift/iOS-Swift/LaunchArgumentTableViewCell.swift b/Samples/iOS-Swift/iOS-Swift/LaunchArgumentTableViewCell.swift index f29a3d07b17..c5f8ff3ffdd 100644 --- a/Samples/iOS-Swift/iOS-Swift/LaunchArgumentTableViewCell.swift +++ b/Samples/iOS-Swift/iOS-Swift/LaunchArgumentTableViewCell.swift @@ -1,3 +1,4 @@ +import SentrySampleShared_Swift import UIKit class LaunchArgumentTableViewCell: UITableViewCell { diff --git a/Samples/iOS-Swift/iOS-Swift6/AppDelegate.swift b/Samples/iOS-Swift/iOS-Swift6/AppDelegate.swift index 7c3e3a4e33c..3457decf054 100644 --- a/Samples/iOS-Swift/iOS-Swift6/AppDelegate.swift +++ b/Samples/iOS-Swift/iOS-Swift6/AppDelegate.swift @@ -1,45 +1,11 @@ import Sentry +import SentrySampleShared_Swift import UIKit @main class AppDelegate: UIResponder, UIApplicationDelegate { - - func startSentry() { - SentrySDK.start(configureOptions: { options in - options.dsn = "https://6cc9bae94def43cab8444a99e0031c28@o447951.ingest.sentry.io/5428557" - options.beforeSend = { event in - print("Sentry: beforeSend called") - return event - } - options.beforeSendSpan = { span in - print("Sentry: beforeSendSpan called") - return span - } - options.beforeCaptureScreenshot = { _ in - print("Sentry: beforeCaptureScreenshot called") - return true - } - options.beforeCaptureViewHierarchy = { _ in - print("Sentry: beforeCaptureViewHierarchy called") - return true - } - options.attachScreenshot = true - options.attachViewHierarchy = true - options.debug = true - options.sampleRate = 1 - options.tracesSampleRate = 1 - - // Experimental features - options.experimental.enableFileManagerSwizzling = true - options.sessionReplay.enableExperimentalViewRenderer = true - // Disable the fast view renderering, because we noticed parts (like the tab bar) are not rendered correctly - options.sessionReplay.enableFastViewRendering = false - }) - - } - func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool { - startSentry() + SentrySDKWrapper.shared.startSentry() return true } @@ -47,8 +13,4 @@ class AppDelegate: UIResponder, UIApplicationDelegate { func application(_ application: UIApplication, configurationForConnecting connectingSceneSession: UISceneSession, options: UIScene.ConnectionOptions) -> UISceneConfiguration { return UISceneConfiguration(name: "Default Configuration", sessionRole: connectingSceneSession.role) } - - func application(_ application: UIApplication, didDiscardSceneSessions sceneSessions: Set) { - } - } diff --git a/Samples/iOS-SwiftUI/iOS-SwiftUI.xcodeproj/project.pbxproj b/Samples/iOS-SwiftUI/iOS-SwiftUI.xcodeproj/project.pbxproj index 37aa847d484..90b7e397d67 100644 --- a/Samples/iOS-SwiftUI/iOS-SwiftUI.xcodeproj/project.pbxproj +++ b/Samples/iOS-SwiftUI/iOS-SwiftUI.xcodeproj/project.pbxproj @@ -15,7 +15,7 @@ 7BB6224F26A56C4E00D0E75E /* ContentView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7BB6224E26A56C4E00D0E75E /* ContentView.swift */; }; 7BB6225426A56C5000D0E75E /* Preview Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 7BB6225326A56C5000D0E75E /* Preview Assets.xcassets */; }; 7BB6225E26A56CB600D0E75E /* Sentry.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 7BB6225C26A56CB600D0E75E /* Sentry.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; }; - 842D55132DA7186B00D3528B /* libSentrySampleShared-Swift.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 842D55122DA7186800D3528B /* libSentrySampleShared-Swift.a */; }; + 841C8A562DA7407E00DCA74F /* libSentrySampleShared-Swift.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 841C8A552DA7407E00DCA74F /* libSentrySampleShared-Swift.a */; }; 84D4FEB528ECD53500EDAAFE /* Sentry.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 84D4FEB228ECD52E00EDAAFE /* Sentry.framework */; }; D8199DCD29376FD90074249E /* SentrySwiftUI.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = D8BBD38B2901AE400011F850 /* SentrySwiftUI.framework */; }; D8199DCE29376FD90074249E /* SentrySwiftUI.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = D8BBD38B2901AE400011F850 /* SentrySwiftUI.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; }; @@ -47,6 +47,20 @@ remoteGlobalIDString = 7BB6224826A56C4E00D0E75E; remoteInfo = "iOS-SwiftUI"; }; + 841C8A5A2DA7408600DCA74F /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = 841C8A572DA7408600DCA74F /* SentrySampleShared.xcodeproj */; + proxyType = 1; + remoteGlobalIDString = 842D547D2DA712C200D3528B; + remoteInfo = "SentrySampleShared-Swift"; + }; + 841C8A5D2DA7408600DCA74F /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = 841C8A572DA7408600DCA74F /* SentrySampleShared.xcodeproj */; + proxyType = 2; + remoteGlobalIDString = 842D547E2DA712C200D3528B; + remoteInfo = "SentrySampleShared-Swift"; + }; 8425DE222B52241000113FEF /* PBXContainerItemProxy */ = { isa = PBXContainerItemProxy; containerPortal = 84D4FEA828ECD52700EDAAFE /* Sentry.xcodeproj */; @@ -103,20 +117,6 @@ remoteGlobalIDString = D833D7342D1321C100961E7A; remoteInfo = SentrySwiftUITests; }; - 842D550E2DA7186800D3528B /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = 842D550B2DA7186800D3528B /* SentrySampleShared.xcodeproj */; - proxyType = 1; - remoteGlobalIDString = 842D547D2DA712C200D3528B; - remoteInfo = "SentrySampleShared-Swift"; - }; - 842D55112DA7186800D3528B /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = 842D550B2DA7186800D3528B /* SentrySampleShared.xcodeproj */; - proxyType = 2; - remoteGlobalIDString = 842D547E2DA712C200D3528B; - remoteInfo = "SentrySampleShared-Swift"; - }; 84D4FEB128ECD52E00EDAAFE /* PBXContainerItemProxy */ = { isa = PBXContainerItemProxy; containerPortal = 84D4FEAA28ECD52E00EDAAFE /* Sentry.xcodeproj */; @@ -187,9 +187,9 @@ 7BB6225526A56C5000D0E75E /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 7BB6225C26A56CB600D0E75E /* Sentry.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; path = Sentry.framework; sourceTree = BUILT_PRODUCTS_DIR; }; 7BB6226026A56E1E00D0E75E /* iOS-SwiftUI.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = "iOS-SwiftUI.entitlements"; sourceTree = ""; }; + 841C8A552DA7407E00DCA74F /* libSentrySampleShared-Swift.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; path = "libSentrySampleShared-Swift.a"; sourceTree = BUILT_PRODUCTS_DIR; }; + 841C8A572DA7408600DCA74F /* SentrySampleShared.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = SentrySampleShared.xcodeproj; path = "/Users/andrewmcknight/Code/organization/getsentry/repos/public/sentry-cocoa/Samples/SentrySampleShared-Swift/SentrySampleShared.xcodeproj"; sourceTree = ""; }; 8425DE1A2B52241000113FEF /* SentryProfilingConditionals.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = SentryProfilingConditionals.h; path = ../../../../Sources/Sentry/Public/SentryProfilingConditionals.h; sourceTree = ""; }; - 842D55082DA7185400D3528B /* SentrySampleShared.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = SentrySampleShared.xcodeproj; path = "../SentrySampleShared-Swift/SentrySampleShared.xcodeproj"; sourceTree = SOURCE_ROOT; }; - 842D550B2DA7186800D3528B /* SentrySampleShared.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = SentrySampleShared.xcodeproj; path = "/Users/andrewmcknight/Code/organization/getsentry/repos/public/sentry-cocoa/Samples/SentrySampleShared-Swift/SentrySampleShared.xcodeproj"; sourceTree = ""; }; 84D4FEA628ECD51800EDAAFE /* Sentry.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; path = Sentry.framework; sourceTree = BUILT_PRODUCTS_DIR; }; 84D4FEA828ECD52700EDAAFE /* Sentry.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = Sentry.xcodeproj; path = ../../Sentry.xcodeproj; sourceTree = ""; }; 84D4FEAA28ECD52E00EDAAFE /* Sentry.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = Sentry.xcodeproj; path = "/Users/andrewmcknight/Code/organization/getsentry/repos/public/sentry-cocoa/Sentry.xcodeproj"; sourceTree = ""; }; @@ -216,7 +216,7 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( - 842D55132DA7186B00D3528B /* libSentrySampleShared-Swift.a in Frameworks */, + 841C8A562DA7407E00DCA74F /* libSentrySampleShared-Swift.a in Frameworks */, 84D4FEB528ECD53500EDAAFE /* Sentry.framework in Frameworks */, D8199DCD29376FD90074249E /* SentrySwiftUI.framework in Frameworks */, ); @@ -251,13 +251,12 @@ 7BB6224026A56C4E00D0E75E = { isa = PBXGroup; children = ( - 842D55082DA7185400D3528B /* SentrySampleShared.xcodeproj */, 7BB6224B26A56C4E00D0E75E /* iOS-SwiftUI */, 7B64385826A6C0A6000D0F65 /* iOS-SwiftUI-UITests */, 7BB6224A26A56C4E00D0E75E /* Products */, 7BB6225B26A56CB600D0E75E /* Frameworks */, 84D4FEAA28ECD52E00EDAAFE /* Sentry.xcodeproj */, - 842D550B2DA7186800D3528B /* SentrySampleShared.xcodeproj */, + 841C8A572DA7408600DCA74F /* SentrySampleShared.xcodeproj */, ); sourceTree = ""; }; @@ -300,6 +299,7 @@ 7BB6225B26A56CB600D0E75E /* Frameworks */ = { isa = PBXGroup; children = ( + 841C8A552DA7407E00DCA74F /* libSentrySampleShared-Swift.a */, 84D4FEA628ECD51800EDAAFE /* Sentry.framework */, 84D4FEA828ECD52700EDAAFE /* Sentry.xcodeproj */, 7BB6225C26A56CB600D0E75E /* Sentry.framework */, @@ -307,10 +307,10 @@ name = Frameworks; sourceTree = ""; }; - 842D550C2DA7186800D3528B /* Products */ = { + 841C8A582DA7408600DCA74F /* Products */ = { isa = PBXGroup; children = ( - 842D55122DA7186800D3528B /* libSentrySampleShared-Swift.a */, + 841C8A5E2DA7408600DCA74F /* libSentrySampleShared-Swift.a */, ); name = Products; sourceTree = ""; @@ -378,7 +378,7 @@ buildRules = ( ); dependencies = ( - 842D550F2DA7186800D3528B /* PBXTargetDependency */, + 841C8A5B2DA7408600DCA74F /* PBXTargetDependency */, ); name = "iOS-SwiftUI"; productName = "iOS-SwiftUI"; @@ -424,8 +424,8 @@ ProjectRef = 84D4FEAA28ECD52E00EDAAFE /* Sentry.xcodeproj */; }, { - ProductGroup = 842D550C2DA7186800D3528B /* Products */; - ProjectRef = 842D550B2DA7186800D3528B /* SentrySampleShared.xcodeproj */; + ProductGroup = 841C8A582DA7408600DCA74F /* Products */; + ProjectRef = 841C8A572DA7408600DCA74F /* SentrySampleShared.xcodeproj */; }, ); projectRoot = ""; @@ -451,6 +451,13 @@ remoteRef = 0A94157F28F6B893006A5DD1 /* PBXContainerItemProxy */; sourceTree = BUILT_PRODUCTS_DIR; }; + 841C8A5E2DA7408600DCA74F /* libSentrySampleShared-Swift.a */ = { + isa = PBXReferenceProxy; + fileType = archive.ar; + path = "libSentrySampleShared-Swift.a"; + remoteRef = 841C8A5D2DA7408600DCA74F /* PBXContainerItemProxy */; + sourceTree = BUILT_PRODUCTS_DIR; + }; 8425DE232B52241000113FEF /* SentryProfilerTests.xctest */ = { isa = PBXReferenceProxy; fileType = wrapper.cfbundle; @@ -507,13 +514,6 @@ remoteRef = 842D55062DA7184E00D3528B /* PBXContainerItemProxy */; sourceTree = BUILT_PRODUCTS_DIR; }; - 842D55122DA7186800D3528B /* libSentrySampleShared-Swift.a */ = { - isa = PBXReferenceProxy; - fileType = archive.ar; - path = "libSentrySampleShared-Swift.a"; - remoteRef = 842D55112DA7186800D3528B /* PBXContainerItemProxy */; - sourceTree = BUILT_PRODUCTS_DIR; - }; 84D4FEB228ECD52E00EDAAFE /* Sentry.framework */ = { isa = PBXReferenceProxy; fileType = wrapper.framework; @@ -632,10 +632,10 @@ target = 7BB6224826A56C4E00D0E75E /* iOS-SwiftUI */; targetProxy = 7B64385C26A6C0A6000D0F65 /* PBXContainerItemProxy */; }; - 842D550F2DA7186800D3528B /* PBXTargetDependency */ = { + 841C8A5B2DA7408600DCA74F /* PBXTargetDependency */ = { isa = PBXTargetDependency; name = "SentrySampleShared-Swift"; - targetProxy = 842D550E2DA7186800D3528B /* PBXContainerItemProxy */; + targetProxy = 841C8A5A2DA7408600DCA74F /* PBXContainerItemProxy */; }; /* End PBXTargetDependency section */ diff --git a/Samples/iOS15-SwiftUI/iOS15-SwiftUI.xcodeproj/project.pbxproj b/Samples/iOS15-SwiftUI/iOS15-SwiftUI.xcodeproj/project.pbxproj index 4ac23f51e5b..9b97944520b 100644 --- a/Samples/iOS15-SwiftUI/iOS15-SwiftUI.xcodeproj/project.pbxproj +++ b/Samples/iOS15-SwiftUI/iOS15-SwiftUI.xcodeproj/project.pbxproj @@ -24,20 +24,6 @@ remoteGlobalIDString = 842D547E2DA712C200D3528B; remoteInfo = "SentrySampleShared-Swift"; }; - 842D551C2DA718FE00D3528B /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = 842D55192DA718FE00D3528B /* SentrySampleShared.xcodeproj */; - proxyType = 1; - remoteGlobalIDString = 842D547D2DA712C200D3528B; - remoteInfo = "SentrySampleShared-Swift"; - }; - 842D551F2DA718FF00D3528B /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = 842D55192DA718FE00D3528B /* SentrySampleShared.xcodeproj */; - proxyType = 2; - remoteGlobalIDString = 842D547E2DA712C200D3528B; - remoteInfo = "SentrySampleShared-Swift"; - }; /* End PBXContainerItemProxy section */ /* Begin PBXCopyFilesBuildPhase section */ @@ -63,7 +49,6 @@ 7B5166762758C72600C0A720 /* Sentry.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; path = Sentry.framework; sourceTree = BUILT_PRODUCTS_DIR; }; 842D55142DA718F200D3528B /* SentrySampleShared.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = SentrySampleShared.xcodeproj; path = "../SentrySampleShared-Swift/SentrySampleShared.xcodeproj"; sourceTree = SOURCE_ROOT; }; 842D55172DA718FB00D3528B /* libSentrySampleShared-Swift.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; path = "libSentrySampleShared-Swift.a"; sourceTree = BUILT_PRODUCTS_DIR; }; - 842D55192DA718FE00D3528B /* SentrySampleShared.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = SentrySampleShared.xcodeproj; path = "/Users/andrewmcknight/Code/organization/getsentry/repos/public/sentry-cocoa/Samples/SentrySampleShared-Swift/SentrySampleShared.xcodeproj"; sourceTree = ""; }; /* End PBXFileReference section */ /* Begin PBXFrameworksBuildPhase section */ @@ -86,7 +71,6 @@ 7B51664A2758C6F000C0A720 /* iOS15-SwiftUI */, 7B5166492758C6F000C0A720 /* Products */, 7B5166752758C72600C0A720 /* Frameworks */, - 842D55192DA718FE00D3528B /* SentrySampleShared.xcodeproj */, ); sourceTree = ""; }; @@ -134,14 +118,6 @@ name = Products; sourceTree = ""; }; - 842D551A2DA718FE00D3528B /* Products */ = { - isa = PBXGroup; - children = ( - 842D55202DA718FF00D3528B /* libSentrySampleShared-Swift.a */, - ); - name = Products; - sourceTree = ""; - }; /* End PBXGroup section */ /* Begin PBXNativeTarget section */ @@ -157,7 +133,6 @@ buildRules = ( ); dependencies = ( - 842D551D2DA718FE00D3528B /* PBXTargetDependency */, ); name = "iOS15-SwiftUI"; productName = "iOS15-SwiftUI"; @@ -191,10 +166,6 @@ productRefGroup = 7B5166492758C6F000C0A720 /* Products */; projectDirPath = ""; projectReferences = ( - { - ProductGroup = 842D551A2DA718FE00D3528B /* Products */; - ProjectRef = 842D55192DA718FE00D3528B /* SentrySampleShared.xcodeproj */; - }, { ProductGroup = 841C8A092DA7253800DCA74F /* Products */; ProjectRef = 842D55142DA718F200D3528B /* SentrySampleShared.xcodeproj */; @@ -215,13 +186,6 @@ remoteRef = 841C8A192DA7253800DCA74F /* PBXContainerItemProxy */; sourceTree = BUILT_PRODUCTS_DIR; }; - 842D55202DA718FF00D3528B /* libSentrySampleShared-Swift.a */ = { - isa = PBXReferenceProxy; - fileType = archive.ar; - path = "libSentrySampleShared-Swift.a"; - remoteRef = 842D551F2DA718FF00D3528B /* PBXContainerItemProxy */; - sourceTree = BUILT_PRODUCTS_DIR; - }; /* End PBXReferenceProxy section */ /* Begin PBXResourcesBuildPhase section */ @@ -248,14 +212,6 @@ }; /* End PBXSourcesBuildPhase section */ -/* Begin PBXTargetDependency section */ - 842D551D2DA718FE00D3528B /* PBXTargetDependency */ = { - isa = PBXTargetDependency; - name = "SentrySampleShared-Swift"; - targetProxy = 842D551C2DA718FE00D3528B /* PBXContainerItemProxy */; - }; -/* End PBXTargetDependency section */ - /* Begin XCBuildConfiguration section */ 7B51666A2758C6F400C0A720 /* Debug */ = { isa = XCBuildConfiguration; From 783f991a372ad7cc967c0e752ff3bc5ee3cf552d Mon Sep 17 00:00:00 2001 From: Andrew McKnight Date: Wed, 9 Apr 2025 16:06:00 -0800 Subject: [PATCH 17/35] use the sdk wrapper in the swift clip too --- .../iOS-Swift/iOS-SwiftClip/AppDelegate.swift | 30 +------------------ 1 file changed, 1 insertion(+), 29 deletions(-) diff --git a/Samples/iOS-Swift/iOS-SwiftClip/AppDelegate.swift b/Samples/iOS-Swift/iOS-SwiftClip/AppDelegate.swift index 48555756d26..c11d098d17e 100644 --- a/Samples/iOS-Swift/iOS-SwiftClip/AppDelegate.swift +++ b/Samples/iOS-Swift/iOS-SwiftClip/AppDelegate.swift @@ -6,28 +6,7 @@ import UIKit class AppDelegate: UIResponder, UIApplicationDelegate { func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool { - - SentrySDK.start { options in - options.dsn = "https://6cc9bae94def43cab8444a99e0031c28@o447951.ingest.sentry.io/5428557" - options.beforeSend = { event in - return event - } - options.debug = true - // Sampling 100% - In Production you probably want to adjust this - options.tracesSampleRate = 1.0 - options.sessionTrackingIntervalMillis = 5_000 - options.initialScope = { scope in - injectGitInformation(scope: scope) - return scope - } - - // Experimental features - options.experimental.enableFileManagerSwizzling = true - options.sessionReplay.enableExperimentalViewRenderer = true - // Disable the fast view renderering, because we noticed parts (like the tab bar) are not rendered correctly - options.sessionReplay.enableFastViewRendering = false - } - + SentrySDKWrapper.shared.startSentry() return true } @@ -38,11 +17,4 @@ class AppDelegate: UIResponder, UIApplicationDelegate { // Use this method to select a configuration to create the new scene with. return UISceneConfiguration(name: "Default Configuration", sessionRole: connectingSceneSession.role) } - - func application(_ application: UIApplication, didDiscardSceneSessions sceneSessions: Set) { - // Called when the user discards a scene session. - // If any sessions were discarded while the application was not running, this will be called shortly after application:didFinishLaunchingWithOptions. - // Use this method to release any resources that were specific to the discarded scenes, as they will not return. - } - } From e33dd2d41c6caf89cfd28c64af3de74a115255a0 Mon Sep 17 00:00:00 2001 From: Andrew McKnight Date: Wed, 16 Apr 2025 16:18:53 -0800 Subject: [PATCH 18/35] use shared wrapper in session replay camera test app --- .../project.pbxproj | 56 +++++++++++++++ .../Sources/AppDelegate.swift | 35 +--------- .../Sources/Base.lproj/Main.storyboard | 68 ++----------------- .../Sources/ViewController.swift | 18 +---- 4 files changed, 63 insertions(+), 114 deletions(-) diff --git a/Samples/SessionReplay-CameraTest/SessionReplay-CameraTest.xcodeproj/project.pbxproj b/Samples/SessionReplay-CameraTest/SessionReplay-CameraTest.xcodeproj/project.pbxproj index 14d9912f5a9..211b1ac9897 100644 --- a/Samples/SessionReplay-CameraTest/SessionReplay-CameraTest.xcodeproj/project.pbxproj +++ b/Samples/SessionReplay-CameraTest/SessionReplay-CameraTest.xcodeproj/project.pbxproj @@ -7,10 +7,28 @@ objects = { /* Begin PBXBuildFile section */ + 84588E842DB07A9700827993 /* libSentrySampleShared-Swift.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 84588E832DB07A9300827993 /* libSentrySampleShared-Swift.a */; }; D49AA4BF2D9FD48400F51498 /* Sentry.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = D49AA4BE2D9FD48400F51498 /* Sentry.framework */; }; D49AA4C02D9FD48400F51498 /* Sentry.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = D49AA4BE2D9FD48400F51498 /* Sentry.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; }; /* End PBXBuildFile section */ +/* Begin PBXContainerItemProxy section */ + 84588E7F2DB07A9300827993 /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = 84588E7C2DB07A9300827993 /* SentrySampleShared.xcodeproj */; + proxyType = 1; + remoteGlobalIDString = 842D547D2DA712C200D3528B; + remoteInfo = "SentrySampleShared-Swift"; + }; + 84588E822DB07A9300827993 /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = 84588E7C2DB07A9300827993 /* SentrySampleShared.xcodeproj */; + proxyType = 2; + remoteGlobalIDString = 842D547E2DA712C200D3528B; + remoteInfo = "SentrySampleShared-Swift"; + }; +/* End PBXContainerItemProxy section */ + /* Begin PBXCopyFilesBuildPhase section */ D49AA4C12D9FD48400F51498 /* Embed Frameworks */ = { isa = PBXCopyFilesBuildPhase; @@ -26,6 +44,8 @@ /* End PBXCopyFilesBuildPhase section */ /* Begin PBXFileReference section */ + 84588E792DB07A8900827993 /* SentrySampleShared.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = SentrySampleShared.xcodeproj; path = "../SentrySampleShared-Swift/SentrySampleShared.xcodeproj"; sourceTree = SOURCE_ROOT; }; + 84588E7C2DB07A9300827993 /* SentrySampleShared.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = SentrySampleShared.xcodeproj; path = "/Users/andrewmcknight/Code/organization/getsentry/repos/public/sentry-cocoa/Samples/SentrySampleShared-Swift/SentrySampleShared.xcodeproj"; sourceTree = ""; }; D49AA4752D9FD43100F51498 /* SessionReplay-CameraTest.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = "SessionReplay-CameraTest.app"; sourceTree = BUILT_PRODUCTS_DIR; }; D49AA4BE2D9FD48400F51498 /* Sentry.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; path = Sentry.framework; sourceTree = BUILT_PRODUCTS_DIR; }; /* End PBXFileReference section */ @@ -62,6 +82,7 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( + 84588E842DB07A9700827993 /* libSentrySampleShared-Swift.a in Frameworks */, D49AA4BF2D9FD48400F51498 /* Sentry.framework in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; @@ -69,13 +90,23 @@ /* End PBXFrameworksBuildPhase section */ /* Begin PBXGroup section */ + 84588E7D2DB07A9300827993 /* Products */ = { + isa = PBXGroup; + children = ( + 84588E832DB07A9300827993 /* libSentrySampleShared-Swift.a */, + ); + name = Products; + sourceTree = ""; + }; D49AA46C2D9FD43100F51498 = { isa = PBXGroup; children = ( + 84588E792DB07A8900827993 /* SentrySampleShared.xcodeproj */, D49AA4C72D9FD8EE00F51498 /* Shared */, D49AA4772D9FD43100F51498 /* Sources */, D49AA4BD2D9FD48400F51498 /* Frameworks */, D49AA4762D9FD43100F51498 /* Products */, + 84588E7C2DB07A9300827993 /* SentrySampleShared.xcodeproj */, ); sourceTree = ""; }; @@ -110,6 +141,7 @@ buildRules = ( ); dependencies = ( + 84588E802DB07A9300827993 /* PBXTargetDependency */, ); fileSystemSynchronizedGroups = ( D49AA4772D9FD43100F51498 /* Sources */, @@ -149,6 +181,12 @@ preferredProjectObjectVersion = 77; productRefGroup = D49AA4762D9FD43100F51498 /* Products */; projectDirPath = ""; + projectReferences = ( + { + ProductGroup = 84588E7D2DB07A9300827993 /* Products */; + ProjectRef = 84588E7C2DB07A9300827993 /* SentrySampleShared.xcodeproj */; + }, + ); projectRoot = ""; targets = ( D49AA4742D9FD43100F51498 /* SessionReplay-CameraTest */, @@ -156,6 +194,16 @@ }; /* End PBXProject section */ +/* Begin PBXReferenceProxy section */ + 84588E832DB07A9300827993 /* libSentrySampleShared-Swift.a */ = { + isa = PBXReferenceProxy; + fileType = archive.ar; + path = "libSentrySampleShared-Swift.a"; + remoteRef = 84588E822DB07A9300827993 /* PBXContainerItemProxy */; + sourceTree = BUILT_PRODUCTS_DIR; + }; +/* End PBXReferenceProxy section */ + /* Begin PBXResourcesBuildPhase section */ D49AA4732D9FD43100F51498 /* Resources */ = { isa = PBXResourcesBuildPhase; @@ -176,6 +224,14 @@ }; /* End PBXSourcesBuildPhase section */ +/* Begin PBXTargetDependency section */ + 84588E802DB07A9300827993 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + name = "SentrySampleShared-Swift"; + targetProxy = 84588E7F2DB07A9300827993 /* PBXContainerItemProxy */; + }; +/* End PBXTargetDependency section */ + /* Begin XCBuildConfiguration section */ D49AA4892D9FD43200F51498 /* Debug */ = { isa = XCBuildConfiguration; diff --git a/Samples/SessionReplay-CameraTest/Sources/AppDelegate.swift b/Samples/SessionReplay-CameraTest/Sources/AppDelegate.swift index ea0ef3665d4..8a199076316 100644 --- a/Samples/SessionReplay-CameraTest/Sources/AppDelegate.swift +++ b/Samples/SessionReplay-CameraTest/Sources/AppDelegate.swift @@ -1,45 +1,14 @@ import Sentry +import SentrySampleShared_Swift import UIKit @main class AppDelegate: UIResponder, UIApplicationDelegate { - - static var isSessionReplayEnabled = true - static var isExperimentalViewRendererEnabled = true - func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool { - AppDelegate.reloadSentrySDK() - + SentrySDKWrapper.shared.startSentry() return true } - static func reloadSentrySDK() { - if SentrySDK.isEnabled { - print("SentrySDK already started, closing it") - SentrySDK.close() - } - - SentrySDK.start { options in - options.dsn = "https://6cc9bae94def43cab8444a99e0031c28@o447951.ingest.sentry.io/5428557" - options.debug = true - - options.tracesSampleRate = 1.0 - options.profilesSampleRate = 1.0 - options.sessionReplay.sessionSampleRate = Self.isSessionReplayEnabled ? 1.0 : 0.0 - - options.initialScope = { scope in - scope.injectGitInformation() - scope.setTag(value: "session-replay-camera-test", key: "sample-project") - return scope - } - - // Experimental features - options.sessionReplay.enableExperimentalViewRenderer = Self.isExperimentalViewRendererEnabled - // Disable the fast view renderering, because we noticed parts (like the tab bar) are not rendered correctly - options.sessionReplay.enableFastViewRendering = false - } - } - // MARK: UISceneSession Lifecycle func application(_ application: UIApplication, configurationForConnecting connectingSceneSession: UISceneSession, options: UIScene.ConnectionOptions) -> UISceneConfiguration { diff --git a/Samples/SessionReplay-CameraTest/Sources/Base.lproj/Main.storyboard b/Samples/SessionReplay-CameraTest/Sources/Base.lproj/Main.storyboard index abb73e9d672..67822f2223f 100644 --- a/Samples/SessionReplay-CameraTest/Sources/Base.lproj/Main.storyboard +++ b/Samples/SessionReplay-CameraTest/Sources/Base.lproj/Main.storyboard @@ -1,9 +1,9 @@ - + - + @@ -18,78 +18,21 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -98,11 +41,8 @@ - - - - + diff --git a/Samples/SessionReplay-CameraTest/Sources/ViewController.swift b/Samples/SessionReplay-CameraTest/Sources/ViewController.swift index 6109923c122..f42d9cd0875 100644 --- a/Samples/SessionReplay-CameraTest/Sources/ViewController.swift +++ b/Samples/SessionReplay-CameraTest/Sources/ViewController.swift @@ -5,11 +5,6 @@ import UIKit class ViewController: UIViewController { @IBOutlet weak var backgroundLabel: UILabel! - @IBOutlet weak var controlsContainerView: UIView! - - @IBOutlet weak var enableSessionReplaySwitch: UISwitch! - @IBOutlet weak var useExperimentalViewRendererSwitch: UISwitch! - private weak var previewView: PreviewView! private weak var errorLabel: UILabel! @@ -29,7 +24,7 @@ class ViewController: UIViewController { private func setupPreviewView() { let previewView = PreviewView() self.previewView = previewView - view.insertSubview(previewView, belowSubview: controlsContainerView) + view.addSubview(previewView) previewView.translatesAutoresizingMaskIntoConstraints = false NSLayoutConstraint.activate([ @@ -86,15 +81,4 @@ class ViewController: UIViewController { captureSession.startRunning() } } - - @IBAction func didChangeToggleValue(_ sender: UISwitch) { - if sender === enableSessionReplaySwitch { - AppDelegate.isSessionReplayEnabled = sender.isOn - print("Enable session replay flag changed to: \(AppDelegate.isSessionReplayEnabled)") - } else if sender === useExperimentalViewRendererSwitch { - AppDelegate.isExperimentalViewRendererEnabled = sender.isOn - print("Use experimental view renderer flag changed to: \(AppDelegate.isExperimentalViewRendererEnabled)") - } - AppDelegate.reloadSentrySDK() - } } From 700ac6ccd1d8717ae7075b7631528cb47befeac8 Mon Sep 17 00:00:00 2001 From: Andrew McKnight Date: Wed, 16 Apr 2025 16:19:12 -0800 Subject: [PATCH 19/35] meta: update clang-format --- scripts/.clang-format-version | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/.clang-format-version b/scripts/.clang-format-version index a9d0c61447b..42ee6ac80e6 100644 --- a/scripts/.clang-format-version +++ b/scripts/.clang-format-version @@ -1 +1 @@ -20.1.2 +20.1.3 From c2a3e04a15227b1190fdd286b680331198988dd7 Mon Sep 17 00:00:00 2001 From: Andrew McKnight Date: Wed, 16 Apr 2025 16:24:15 -0800 Subject: [PATCH 20/35] xcode automatic addition of product --- .../project.pbxproj | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/Samples/SessionReplay-CameraTest/SessionReplay-CameraTest.xcodeproj/project.pbxproj b/Samples/SessionReplay-CameraTest/SessionReplay-CameraTest.xcodeproj/project.pbxproj index 211b1ac9897..d970e4848f7 100644 --- a/Samples/SessionReplay-CameraTest/SessionReplay-CameraTest.xcodeproj/project.pbxproj +++ b/Samples/SessionReplay-CameraTest/SessionReplay-CameraTest.xcodeproj/project.pbxproj @@ -98,6 +98,13 @@ name = Products; sourceTree = ""; }; + 84588EB22DB0812D00827993 /* Products */ = { + isa = PBXGroup; + children = ( + ); + name = Products; + sourceTree = ""; + }; D49AA46C2D9FD43100F51498 = { isa = PBXGroup; children = ( @@ -186,6 +193,10 @@ ProductGroup = 84588E7D2DB07A9300827993 /* Products */; ProjectRef = 84588E7C2DB07A9300827993 /* SentrySampleShared.xcodeproj */; }, + { + ProductGroup = 84588EB22DB0812D00827993 /* Products */; + ProjectRef = 84588E792DB07A8900827993 /* SentrySampleShared.xcodeproj */; + }, ); projectRoot = ""; targets = ( From fe77ca7ff17f11397eccfd60fa076bf7aaa73a63 Mon Sep 17 00:00:00 2001 From: Andrew McKnight Date: Wed, 16 Apr 2025 16:57:58 -0800 Subject: [PATCH 21/35] fix double ref --- .../project.pbxproj | 13 ------------- 1 file changed, 13 deletions(-) diff --git a/Samples/SessionReplay-CameraTest/SessionReplay-CameraTest.xcodeproj/project.pbxproj b/Samples/SessionReplay-CameraTest/SessionReplay-CameraTest.xcodeproj/project.pbxproj index d970e4848f7..d3026cbdc7e 100644 --- a/Samples/SessionReplay-CameraTest/SessionReplay-CameraTest.xcodeproj/project.pbxproj +++ b/Samples/SessionReplay-CameraTest/SessionReplay-CameraTest.xcodeproj/project.pbxproj @@ -44,7 +44,6 @@ /* End PBXCopyFilesBuildPhase section */ /* Begin PBXFileReference section */ - 84588E792DB07A8900827993 /* SentrySampleShared.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = SentrySampleShared.xcodeproj; path = "../SentrySampleShared-Swift/SentrySampleShared.xcodeproj"; sourceTree = SOURCE_ROOT; }; 84588E7C2DB07A9300827993 /* SentrySampleShared.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = SentrySampleShared.xcodeproj; path = "/Users/andrewmcknight/Code/organization/getsentry/repos/public/sentry-cocoa/Samples/SentrySampleShared-Swift/SentrySampleShared.xcodeproj"; sourceTree = ""; }; D49AA4752D9FD43100F51498 /* SessionReplay-CameraTest.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = "SessionReplay-CameraTest.app"; sourceTree = BUILT_PRODUCTS_DIR; }; D49AA4BE2D9FD48400F51498 /* Sentry.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; path = Sentry.framework; sourceTree = BUILT_PRODUCTS_DIR; }; @@ -98,17 +97,9 @@ name = Products; sourceTree = ""; }; - 84588EB22DB0812D00827993 /* Products */ = { - isa = PBXGroup; - children = ( - ); - name = Products; - sourceTree = ""; - }; D49AA46C2D9FD43100F51498 = { isa = PBXGroup; children = ( - 84588E792DB07A8900827993 /* SentrySampleShared.xcodeproj */, D49AA4C72D9FD8EE00F51498 /* Shared */, D49AA4772D9FD43100F51498 /* Sources */, D49AA4BD2D9FD48400F51498 /* Frameworks */, @@ -193,10 +184,6 @@ ProductGroup = 84588E7D2DB07A9300827993 /* Products */; ProjectRef = 84588E7C2DB07A9300827993 /* SentrySampleShared.xcodeproj */; }, - { - ProductGroup = 84588EB22DB0812D00827993 /* Products */; - ProjectRef = 84588E792DB07A8900827993 /* SentrySampleShared.xcodeproj */; - }, ); projectRoot = ""; targets = ( From b1e0a3ac58db74bc7e170d8744ac39b235c75e84 Mon Sep 17 00:00:00 2001 From: Andrew McKnight Date: Wed, 16 Apr 2025 17:01:36 -0800 Subject: [PATCH 22/35] fix objectVersion compatibility --- .../SentrySampleShared.xcodeproj/project.pbxproj | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/Samples/SentrySampleShared-Swift/SentrySampleShared.xcodeproj/project.pbxproj b/Samples/SentrySampleShared-Swift/SentrySampleShared.xcodeproj/project.pbxproj index eef38dc6c81..ef60191e569 100644 --- a/Samples/SentrySampleShared-Swift/SentrySampleShared.xcodeproj/project.pbxproj +++ b/Samples/SentrySampleShared-Swift/SentrySampleShared.xcodeproj/project.pbxproj @@ -3,7 +3,7 @@ archiveVersion = 1; classes = { }; - objectVersion = 77; + objectVersion = 70; objects = { /* Begin PBXBuildFile section */ @@ -28,11 +28,7 @@ /* End PBXFileReference section */ /* Begin PBXFileSystemSynchronizedRootGroup section */ - 842D54802DA712C200D3528B /* SentrySampleShared-Swift */ = { - isa = PBXFileSystemSynchronizedRootGroup; - path = "SentrySampleShared-Swift"; - sourceTree = ""; - }; + 842D54802DA712C200D3528B /* SentrySampleShared-Swift */ = {isa = PBXFileSystemSynchronizedRootGroup; explicitFileTypes = {}; explicitFolders = (); path = "SentrySampleShared-Swift"; sourceTree = ""; }; /* End PBXFileSystemSynchronizedRootGroup section */ /* Begin PBXFrameworksBuildPhase section */ @@ -114,6 +110,7 @@ }; }; buildConfigurationList = 842D54792DA712C200D3528B /* Build configuration list for PBXProject "SentrySampleShared" */; + compatibilityVersion = "Xcode 15.0"; developmentRegion = en; hasScannedForEncodings = 0; knownRegions = ( @@ -122,7 +119,6 @@ ); mainGroup = 842D54752DA712C200D3528B; minimizedProjectReferenceProxies = 1; - preferredProjectObjectVersion = 77; productRefGroup = 842D547F2DA712C200D3528B /* Products */; projectDirPath = ""; projectRoot = ""; From 1b18905760188314a7f5f8d18a428814dd0d0147 Mon Sep 17 00:00:00 2001 From: Andrew McKnight Date: Wed, 16 Apr 2025 17:18:16 -0800 Subject: [PATCH 23/35] add test/testci build configs to shared lib target; sentry project dependency --- .gitignore | 1 + .../project.pbxproj | 158 ++++++++++++++++++ 2 files changed, 159 insertions(+) diff --git a/.gitignore b/.gitignore index 59cae7ee86a..310c926890a 100644 --- a/.gitignore +++ b/.gitignore @@ -224,3 +224,4 @@ dist .yarn/build-state.yml .yarn/install-state.gz .pnp.* +*xcshareddata diff --git a/Samples/SentrySampleShared-Swift/SentrySampleShared.xcodeproj/project.pbxproj b/Samples/SentrySampleShared-Swift/SentrySampleShared.xcodeproj/project.pbxproj index ef60191e569..2f8fcb05aad 100644 --- a/Samples/SentrySampleShared-Swift/SentrySampleShared.xcodeproj/project.pbxproj +++ b/Samples/SentrySampleShared-Swift/SentrySampleShared.xcodeproj/project.pbxproj @@ -25,6 +25,7 @@ /* Begin PBXFileReference section */ 842D547E2DA712C200D3528B /* libSentrySampleShared-Swift.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libSentrySampleShared-Swift.a"; sourceTree = BUILT_PRODUCTS_DIR; }; 842D54AF2DA713F900D3528B /* Sentry.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; path = Sentry.framework; sourceTree = BUILT_PRODUCTS_DIR; }; + 84588F612DB08C5F00827993 /* Sentry.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = Sentry.xcodeproj; path = ../../Sentry.xcodeproj; sourceTree = ""; }; /* End PBXFileReference section */ /* Begin PBXFileSystemSynchronizedRootGroup section */ @@ -46,6 +47,7 @@ 842D54752DA712C200D3528B = { isa = PBXGroup; children = ( + 84588F612DB08C5F00827993 /* Sentry.xcodeproj */, 842D54802DA712C200D3528B /* SentrySampleShared-Swift */, 842D54AE2DA713F900D3528B /* Frameworks */, 842D547F2DA712C200D3528B /* Products */, @@ -297,6 +299,158 @@ }; name = Release; }; + 84588F7E2DB08D2200827993 /* Test */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + ASSETCATALOG_COMPILER_GENERATE_SWIFT_ASSET_SYMBOL_EXTENSIONS = YES; + CLANG_ANALYZER_NONNULL = YES; + CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++20"; + CLANG_ENABLE_MODULES = YES; + CLANG_ENABLE_OBJC_ARC = YES; + CLANG_ENABLE_OBJC_WEAK = YES; + CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_COMMA = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; + CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; + CLANG_WARN_DOCUMENTATION_COMMENTS = YES; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INFINITE_RECURSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; + CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; + CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; + CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES; + CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; + CLANG_WARN_STRICT_PROTOTYPES = YES; + CLANG_WARN_SUSPICIOUS_MOVE = YES; + CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; + CLANG_WARN_UNREACHABLE_CODE = YES; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + COPY_PHASE_STRIP = NO; + DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; + ENABLE_NS_ASSERTIONS = NO; + ENABLE_STRICT_OBJC_MSGSEND = YES; + ENABLE_USER_SCRIPT_SANDBOXING = YES; + GCC_C_LANGUAGE_STANDARD = gnu17; + GCC_NO_COMMON_BLOCKS = YES; + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; + GCC_WARN_UNDECLARED_SELECTOR = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; + GCC_WARN_UNUSED_FUNCTION = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + IPHONEOS_DEPLOYMENT_TARGET = 18.2; + LOCALIZATION_PREFERS_STRING_CATALOGS = YES; + MTL_ENABLE_DEBUG_INFO = NO; + MTL_FAST_MATH = YES; + SDKROOT = iphoneos; + SWIFT_COMPILATION_MODE = wholemodule; + VALIDATE_PRODUCT = YES; + }; + name = Test; + }; + 84588F7F2DB08D2200827993 /* Test */ = { + isa = XCBuildConfiguration; + buildSettings = { + ARCHS = ( + "$(ARCHS_STANDARD)", + arm64e, + ); + CLANG_ENABLE_MODULES = YES; + CODE_SIGN_STYLE = Automatic; + DEVELOPMENT_TEAM = 97JCY7859U; + IPHONEOS_DEPLOYMENT_TARGET = 13.0; + ONLY_ACTIVE_ARCH = YES; + OTHER_LDFLAGS = "-ObjC"; + PRODUCT_NAME = "$(TARGET_NAME)"; + SKIP_INSTALL = YES; + SWIFT_VERSION = 5.0; + TARGETED_DEVICE_FAMILY = "1,2"; + }; + name = Test; + }; + 84588F802DB08D2700827993 /* TestCI */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + ASSETCATALOG_COMPILER_GENERATE_SWIFT_ASSET_SYMBOL_EXTENSIONS = YES; + CLANG_ANALYZER_NONNULL = YES; + CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++20"; + CLANG_ENABLE_MODULES = YES; + CLANG_ENABLE_OBJC_ARC = YES; + CLANG_ENABLE_OBJC_WEAK = YES; + CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_COMMA = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; + CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; + CLANG_WARN_DOCUMENTATION_COMMENTS = YES; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INFINITE_RECURSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; + CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; + CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; + CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES; + CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; + CLANG_WARN_STRICT_PROTOTYPES = YES; + CLANG_WARN_SUSPICIOUS_MOVE = YES; + CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; + CLANG_WARN_UNREACHABLE_CODE = YES; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + COPY_PHASE_STRIP = NO; + DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; + ENABLE_NS_ASSERTIONS = NO; + ENABLE_STRICT_OBJC_MSGSEND = YES; + ENABLE_USER_SCRIPT_SANDBOXING = YES; + GCC_C_LANGUAGE_STANDARD = gnu17; + GCC_NO_COMMON_BLOCKS = YES; + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; + GCC_WARN_UNDECLARED_SELECTOR = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; + GCC_WARN_UNUSED_FUNCTION = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + IPHONEOS_DEPLOYMENT_TARGET = 18.2; + LOCALIZATION_PREFERS_STRING_CATALOGS = YES; + MTL_ENABLE_DEBUG_INFO = NO; + MTL_FAST_MATH = YES; + SDKROOT = iphoneos; + SWIFT_COMPILATION_MODE = wholemodule; + VALIDATE_PRODUCT = YES; + }; + name = TestCI; + }; + 84588F812DB08D2700827993 /* TestCI */ = { + isa = XCBuildConfiguration; + buildSettings = { + ARCHS = ( + "$(ARCHS_STANDARD)", + arm64e, + ); + CLANG_ENABLE_MODULES = YES; + CODE_SIGN_STYLE = Automatic; + DEVELOPMENT_TEAM = 97JCY7859U; + IPHONEOS_DEPLOYMENT_TARGET = 13.0; + ONLY_ACTIVE_ARCH = YES; + OTHER_LDFLAGS = "-ObjC"; + PRODUCT_NAME = "$(TARGET_NAME)"; + SKIP_INSTALL = YES; + SWIFT_VERSION = 5.0; + TARGETED_DEVICE_FAMILY = "1,2"; + }; + name = TestCI; + }; /* End XCBuildConfiguration section */ /* Begin XCConfigurationList section */ @@ -305,6 +459,8 @@ buildConfigurations = ( 842D54832DA712C200D3528B /* Debug */, 842D54842DA712C200D3528B /* Release */, + 84588F802DB08D2700827993 /* TestCI */, + 84588F7E2DB08D2200827993 /* Test */, ); defaultConfigurationIsVisible = 0; defaultConfigurationName = Release; @@ -314,6 +470,8 @@ buildConfigurations = ( 842D54862DA712C200D3528B /* Debug */, 842D54872DA712C200D3528B /* Release */, + 84588F812DB08D2700827993 /* TestCI */, + 84588F7F2DB08D2200827993 /* Test */, ); defaultConfigurationIsVisible = 0; defaultConfigurationName = Release; From 296bdc0fb1d8a6d52ccf3787fbb1aa3824466827 Mon Sep 17 00:00:00 2001 From: Andrew McKnight Date: Wed, 16 Apr 2025 17:25:22 -0800 Subject: [PATCH 24/35] remove old project of same name --- .../project.pbxproj | 299 ------------------ 1 file changed, 299 deletions(-) delete mode 100644 Samples/SentrySampleShared/SentrySampleShared.xcodeproj/project.pbxproj diff --git a/Samples/SentrySampleShared/SentrySampleShared.xcodeproj/project.pbxproj b/Samples/SentrySampleShared/SentrySampleShared.xcodeproj/project.pbxproj deleted file mode 100644 index c43c19937e2..00000000000 --- a/Samples/SentrySampleShared/SentrySampleShared.xcodeproj/project.pbxproj +++ /dev/null @@ -1,299 +0,0 @@ -// !$*UTF8*$! -{ - archiveVersion = 1; - classes = { - }; - objectVersion = 77; - objects = { - -/* Begin PBXCopyFilesBuildPhase section */ - 842D53192DA702C400D3528B /* CopyFiles */ = { - isa = PBXCopyFilesBuildPhase; - buildActionMask = 2147483647; - dstPath = "include/$(PRODUCT_NAME)"; - dstSubfolderSpec = 16; - files = ( - ); - runOnlyForDeploymentPostprocessing = 0; - }; -/* End PBXCopyFilesBuildPhase section */ - -/* Begin PBXFileReference section */ - 842D531B2DA702C400D3528B /* libSentrySampleShared.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libSentrySampleShared.a; sourceTree = BUILT_PRODUCTS_DIR; }; -/* End PBXFileReference section */ - -/* Begin PBXFileSystemSynchronizedRootGroup section */ - 842D531D2DA702C400D3528B /* SentrySampleShared */ = { - isa = PBXFileSystemSynchronizedRootGroup; - path = SentrySampleShared; - sourceTree = ""; - }; -/* End PBXFileSystemSynchronizedRootGroup section */ - -/* Begin PBXFrameworksBuildPhase section */ - 842D53182DA702C400D3528B /* Frameworks */ = { - isa = PBXFrameworksBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - runOnlyForDeploymentPostprocessing = 0; - }; -/* End PBXFrameworksBuildPhase section */ - -/* Begin PBXGroup section */ - 842D53122DA702C400D3528B = { - isa = PBXGroup; - children = ( - 842D531D2DA702C400D3528B /* SentrySampleShared */, - 842D531C2DA702C400D3528B /* Products */, - ); - sourceTree = ""; - }; - 842D531C2DA702C400D3528B /* Products */ = { - isa = PBXGroup; - children = ( - 842D531B2DA702C400D3528B /* libSentrySampleShared.a */, - ); - name = Products; - sourceTree = ""; - }; -/* End PBXGroup section */ - -/* Begin PBXNativeTarget section */ - 842D531A2DA702C400D3528B /* SentrySampleShared */ = { - isa = PBXNativeTarget; - buildConfigurationList = 842D53222DA702C400D3528B /* Build configuration list for PBXNativeTarget "SentrySampleShared" */; - buildPhases = ( - 842D53172DA702C400D3528B /* Sources */, - 842D53182DA702C400D3528B /* Frameworks */, - 842D53192DA702C400D3528B /* CopyFiles */, - ); - buildRules = ( - ); - dependencies = ( - ); - fileSystemSynchronizedGroups = ( - 842D531D2DA702C400D3528B /* SentrySampleShared */, - ); - name = SentrySampleShared; - packageProductDependencies = ( - ); - productName = SentrySampleShared; - productReference = 842D531B2DA702C400D3528B /* libSentrySampleShared.a */; - productType = "com.apple.product-type.library.static"; - }; -/* End PBXNativeTarget section */ - -/* Begin PBXProject section */ - 842D53132DA702C400D3528B /* Project object */ = { - isa = PBXProject; - attributes = { - BuildIndependentTargetsInParallel = 1; - LastSwiftUpdateCheck = 1620; - LastUpgradeCheck = 1620; - TargetAttributes = { - 842D531A2DA702C400D3528B = { - CreatedOnToolsVersion = 16.2; - }; - }; - }; - buildConfigurationList = 842D53162DA702C400D3528B /* Build configuration list for PBXProject "SentrySampleShared" */; - developmentRegion = en; - hasScannedForEncodings = 0; - knownRegions = ( - en, - Base, - ); - mainGroup = 842D53122DA702C400D3528B; - minimizedProjectReferenceProxies = 1; - preferredProjectObjectVersion = 77; - productRefGroup = 842D531C2DA702C400D3528B /* Products */; - projectDirPath = ""; - projectRoot = ""; - targets = ( - 842D531A2DA702C400D3528B /* SentrySampleShared */, - ); - }; -/* End PBXProject section */ - -/* Begin PBXSourcesBuildPhase section */ - 842D53172DA702C400D3528B /* Sources */ = { - isa = PBXSourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - runOnlyForDeploymentPostprocessing = 0; - }; -/* End PBXSourcesBuildPhase section */ - -/* Begin XCBuildConfiguration section */ - 842D53202DA702C400D3528B /* Debug */ = { - isa = XCBuildConfiguration; - buildSettings = { - ALWAYS_SEARCH_USER_PATHS = NO; - ASSETCATALOG_COMPILER_GENERATE_SWIFT_ASSET_SYMBOL_EXTENSIONS = YES; - CLANG_ANALYZER_NONNULL = YES; - CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; - CLANG_CXX_LANGUAGE_STANDARD = "gnu++20"; - CLANG_ENABLE_MODULES = YES; - CLANG_ENABLE_OBJC_ARC = YES; - CLANG_ENABLE_OBJC_WEAK = YES; - CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; - CLANG_WARN_BOOL_CONVERSION = YES; - CLANG_WARN_COMMA = YES; - CLANG_WARN_CONSTANT_CONVERSION = YES; - CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; - CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; - CLANG_WARN_DOCUMENTATION_COMMENTS = YES; - CLANG_WARN_EMPTY_BODY = YES; - CLANG_WARN_ENUM_CONVERSION = YES; - CLANG_WARN_INFINITE_RECURSION = YES; - CLANG_WARN_INT_CONVERSION = YES; - CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; - CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; - CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; - CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; - CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES; - CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; - CLANG_WARN_STRICT_PROTOTYPES = YES; - CLANG_WARN_SUSPICIOUS_MOVE = YES; - CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; - CLANG_WARN_UNREACHABLE_CODE = YES; - CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; - COPY_PHASE_STRIP = NO; - DEBUG_INFORMATION_FORMAT = dwarf; - ENABLE_STRICT_OBJC_MSGSEND = YES; - ENABLE_TESTABILITY = YES; - ENABLE_USER_SCRIPT_SANDBOXING = YES; - GCC_C_LANGUAGE_STANDARD = gnu17; - GCC_DYNAMIC_NO_PIC = NO; - GCC_NO_COMMON_BLOCKS = YES; - GCC_OPTIMIZATION_LEVEL = 0; - GCC_PREPROCESSOR_DEFINITIONS = ( - "DEBUG=1", - "$(inherited)", - ); - GCC_WARN_64_TO_32_BIT_CONVERSION = YES; - GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; - GCC_WARN_UNDECLARED_SELECTOR = YES; - GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; - GCC_WARN_UNUSED_FUNCTION = YES; - GCC_WARN_UNUSED_VARIABLE = YES; - IPHONEOS_DEPLOYMENT_TARGET = 18.2; - LOCALIZATION_PREFERS_STRING_CATALOGS = YES; - MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE; - MTL_FAST_MATH = YES; - ONLY_ACTIVE_ARCH = YES; - SDKROOT = iphoneos; - SWIFT_ACTIVE_COMPILATION_CONDITIONS = "DEBUG $(inherited)"; - SWIFT_OPTIMIZATION_LEVEL = "-Onone"; - }; - name = Debug; - }; - 842D53212DA702C400D3528B /* Release */ = { - isa = XCBuildConfiguration; - buildSettings = { - ALWAYS_SEARCH_USER_PATHS = NO; - ASSETCATALOG_COMPILER_GENERATE_SWIFT_ASSET_SYMBOL_EXTENSIONS = YES; - CLANG_ANALYZER_NONNULL = YES; - CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; - CLANG_CXX_LANGUAGE_STANDARD = "gnu++20"; - CLANG_ENABLE_MODULES = YES; - CLANG_ENABLE_OBJC_ARC = YES; - CLANG_ENABLE_OBJC_WEAK = YES; - CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; - CLANG_WARN_BOOL_CONVERSION = YES; - CLANG_WARN_COMMA = YES; - CLANG_WARN_CONSTANT_CONVERSION = YES; - CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; - CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; - CLANG_WARN_DOCUMENTATION_COMMENTS = YES; - CLANG_WARN_EMPTY_BODY = YES; - CLANG_WARN_ENUM_CONVERSION = YES; - CLANG_WARN_INFINITE_RECURSION = YES; - CLANG_WARN_INT_CONVERSION = YES; - CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; - CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; - CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; - CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; - CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES; - CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; - CLANG_WARN_STRICT_PROTOTYPES = YES; - CLANG_WARN_SUSPICIOUS_MOVE = YES; - CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; - CLANG_WARN_UNREACHABLE_CODE = YES; - CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; - COPY_PHASE_STRIP = NO; - DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; - ENABLE_NS_ASSERTIONS = NO; - ENABLE_STRICT_OBJC_MSGSEND = YES; - ENABLE_USER_SCRIPT_SANDBOXING = YES; - GCC_C_LANGUAGE_STANDARD = gnu17; - GCC_NO_COMMON_BLOCKS = YES; - GCC_WARN_64_TO_32_BIT_CONVERSION = YES; - GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; - GCC_WARN_UNDECLARED_SELECTOR = YES; - GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; - GCC_WARN_UNUSED_FUNCTION = YES; - GCC_WARN_UNUSED_VARIABLE = YES; - IPHONEOS_DEPLOYMENT_TARGET = 18.2; - LOCALIZATION_PREFERS_STRING_CATALOGS = YES; - MTL_ENABLE_DEBUG_INFO = NO; - MTL_FAST_MATH = YES; - SDKROOT = iphoneos; - SWIFT_COMPILATION_MODE = wholemodule; - VALIDATE_PRODUCT = YES; - }; - name = Release; - }; - 842D53232DA702C400D3528B /* Debug */ = { - isa = XCBuildConfiguration; - buildSettings = { - CODE_SIGN_STYLE = Automatic; - DEVELOPMENT_TEAM = 97JCY7859U; - OTHER_LDFLAGS = "-ObjC"; - PRODUCT_NAME = "$(TARGET_NAME)"; - SKIP_INSTALL = YES; - SWIFT_VERSION = 5.0; - TARGETED_DEVICE_FAMILY = "1,2"; - }; - name = Debug; - }; - 842D53242DA702C400D3528B /* Release */ = { - isa = XCBuildConfiguration; - buildSettings = { - CODE_SIGN_STYLE = Automatic; - DEVELOPMENT_TEAM = 97JCY7859U; - OTHER_LDFLAGS = "-ObjC"; - PRODUCT_NAME = "$(TARGET_NAME)"; - SKIP_INSTALL = YES; - SWIFT_VERSION = 5.0; - TARGETED_DEVICE_FAMILY = "1,2"; - }; - name = Release; - }; -/* End XCBuildConfiguration section */ - -/* Begin XCConfigurationList section */ - 842D53162DA702C400D3528B /* Build configuration list for PBXProject "SentrySampleShared" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - 842D53202DA702C400D3528B /* Debug */, - 842D53212DA702C400D3528B /* Release */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Release; - }; - 842D53222DA702C400D3528B /* Build configuration list for PBXNativeTarget "SentrySampleShared" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - 842D53232DA702C400D3528B /* Debug */, - 842D53242DA702C400D3528B /* Release */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Release; - }; -/* End XCConfigurationList section */ - }; - rootObject = 842D53132DA702C400D3528B /* Project object */; -} From f2eb91d8ab5697f1a7e1071f114f6235053e7056 Mon Sep 17 00:00:00 2001 From: Andrew McKnight Date: Thu, 17 Apr 2025 10:13:04 -0800 Subject: [PATCH 25/35] remove logging added to sdk for separate PR --- Sources/Sentry/Profiling/SentryLaunchProfiling.m | 11 ----------- 1 file changed, 11 deletions(-) diff --git a/Sources/Sentry/Profiling/SentryLaunchProfiling.m b/Sources/Sentry/Profiling/SentryLaunchProfiling.m index 825c82622bb..fbc397e0a9d 100644 --- a/Sources/Sentry/Profiling/SentryLaunchProfiling.m +++ b/Sources/Sentry/Profiling/SentryLaunchProfiling.m @@ -385,17 +385,6 @@ void sentry_stopAndDiscardLaunchProfileTracer(void) { - if (sentry_launchTracer == nil) { - if (sentry_isTracingAppLaunch) { - SENTRY_LOG_WARN(@"Inconsistent state detected for app launch tracking."); - } - return; - } - - if (!sentry_isTracingAppLaunch) { - SENTRY_LOG_WARN(@"Inconsistent state detected for app launch tracking."); - } - SENTRY_LOG_DEBUG(@"Finishing launch tracer."); [sentry_launchTracer finish]; sentry_isTracingAppLaunch = NO; From 10aec26b8a95dd616e905ba152df89a2208010eb Mon Sep 17 00:00:00 2001 From: Andrew McKnight Date: Thu, 17 Apr 2025 10:16:25 -0800 Subject: [PATCH 26/35] use more descriptive fatalError messages --- .../iOS-Swift/SentrySDKOverrides.swift | 22 +++++++++---------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/Samples/iOS-Swift/iOS-Swift/SentrySDKOverrides.swift b/Samples/iOS-Swift/iOS-Swift/SentrySDKOverrides.swift index 03da9154eed..66869e5c535 100644 --- a/Samples/iOS-Swift/iOS-Swift/SentrySDKOverrides.swift +++ b/Samples/iOS-Swift/iOS-Swift/SentrySDKOverrides.swift @@ -109,7 +109,7 @@ public enum SentrySDKOverrides { public var boolValue: Bool { get { switch self { - case .userName, .userEmail: fatalError("Invalid") + case .userName, .userEmail: fatalError("Use stringValue to get the value of this override") default: return getBoolOverride(for: "--io.sentry.disable-everything") || getBoolOverride(for: rawValue) } } @@ -122,13 +122,13 @@ public enum SentrySDKOverrides { get { switch self { case .userName, .userEmail: return getStringValueOverride(for: rawValue) - default: fatalError("Invalid") + default: fatalError("Use boolValue to get the value of this override") } } set(newValue) { switch self { case .userName, .userEmail: return setStringOverride(for: rawValue, value: newValue) - default: fatalError("Invalid") + default: fatalError("Use boolValue to get the value of this override") } } } @@ -145,13 +145,13 @@ public enum SentrySDKOverrides { public var boolValue: Bool { get { switch self { - case .sampleRate, .samplerValue: fatalError("Invalid") + case .sampleRate, .samplerValue: fatalError("Use floatValue to get the value of this override") default: return getBoolOverride(for: "--io.sentry.disable-everything") || getBoolOverride(for: rawValue) } } set(newValue) { switch self { - case .sampleRate, .samplerValue: fatalError("Invalid") + case .sampleRate, .samplerValue: fatalError("Use floatValue to get the value of this override") default: setBoolOverride(for: rawValue, value: newValue) } } @@ -160,13 +160,13 @@ public enum SentrySDKOverrides { public var floatValue: Float? { get { switch self { - case .disableTracing: fatalError("Invalid") + case .disableTracing: fatalError("Use boolValue to get the value of this override") default: return getFloatValueOverride(for: rawValue) } } set(newValue) { switch self { - case .disableTracing: fatalError("Invalid") + case .disableTracing: fatalError("Use boolValue to get the value of this override") default: setFloatOverride(for: rawValue, value: newValue) } } @@ -187,14 +187,14 @@ public enum SentrySDKOverrides { public var boolValue: Bool { get { switch self { - case .sampleRate, .samplerValue, .sessionSampleRate: fatalError("Invalid") + case .sampleRate, .samplerValue, .sessionSampleRate: fatalError("Use floatValue to get the value of this override") case .disableUIProfiling, .disableAppStartProfiling: return getBoolOverride(for: "--io.sentry.disable-everything") || getBoolOverride(for: rawValue) default: return getBoolOverride(for: rawValue) } } set(newValue) { switch self { - case .sampleRate, .samplerValue, .sessionSampleRate: fatalError("Invalid") + case .sampleRate, .samplerValue, .sessionSampleRate: fatalError("Use floatValue to get the value of this override") default: setBoolOverride(for: rawValue, value: newValue) } } @@ -203,13 +203,13 @@ public enum SentrySDKOverrides { public var floatValue: Float? { get { switch self { - case .disableUIProfiling, .disableAppStartProfiling, .manualLifecycle: fatalError("Invalid") + case .disableUIProfiling, .disableAppStartProfiling, .manualLifecycle: fatalError("Use boolValue to get the value of this override") default: return getFloatValueOverride(for: rawValue) } } set(newValue) { switch self { - case .disableUIProfiling, .disableAppStartProfiling, .manualLifecycle: fatalError("Invalid") + case .disableUIProfiling, .disableAppStartProfiling, .manualLifecycle: fatalError("Use boolValue to get the value of this override") default: setFloatOverride(for: rawValue, value: newValue) } } From 74251ff27002e7989ff2e4390a75dd438e7ded2c Mon Sep 17 00:00:00 2001 From: Andrew McKnight Date: Thu, 17 Apr 2025 10:36:50 -0800 Subject: [PATCH 27/35] try overwriting all objectVersion numbers to the earliest one that originally appeared --- .../XCFramework.xcodeproj/project.pbxproj | 2 +- .../SentrySampleShared.xcodeproj/project.pbxproj | 15 ++++++++++++++- .../project.pbxproj | 2 +- .../project.pbxproj | 2 +- .../iOS-Swift/iOS-Swift.xcodeproj/project.pbxproj | 2 +- .../iOS15-SwiftUI.xcodeproj/project.pbxproj | 2 +- .../macOS-SwiftUI.xcodeproj/project.pbxproj | 2 +- .../visionOS-Swift.xcodeproj/project.pbxproj | 2 +- Sentry.xcodeproj/project.pbxproj | 2 +- .../SwiftUITestSample.xcodeproj/project.pbxproj | 2 +- .../DuplicatedSDKTest.xcodeproj/project.pbxproj | 2 +- .../test-app-plain.xcodeproj/project.pbxproj | 2 +- .../test-app-sentry.xcodeproj/project.pbxproj | 2 +- 13 files changed, 26 insertions(+), 13 deletions(-) diff --git a/Samples/Carthage-Validation/XCFramework/XCFramework.xcodeproj/project.pbxproj b/Samples/Carthage-Validation/XCFramework/XCFramework.xcodeproj/project.pbxproj index 2809479991d..83b88fe62d8 100644 --- a/Samples/Carthage-Validation/XCFramework/XCFramework.xcodeproj/project.pbxproj +++ b/Samples/Carthage-Validation/XCFramework/XCFramework.xcodeproj/project.pbxproj @@ -3,7 +3,7 @@ archiveVersion = 1; classes = { }; - objectVersion = 52; + objectVersion = 50; objects = { /* Begin PBXBuildFile section */ diff --git a/Samples/SentrySampleShared-Swift/SentrySampleShared.xcodeproj/project.pbxproj b/Samples/SentrySampleShared-Swift/SentrySampleShared.xcodeproj/project.pbxproj index 2f8fcb05aad..6f5e3769923 100644 --- a/Samples/SentrySampleShared-Swift/SentrySampleShared.xcodeproj/project.pbxproj +++ b/Samples/SentrySampleShared-Swift/SentrySampleShared.xcodeproj/project.pbxproj @@ -3,7 +3,7 @@ archiveVersion = 1; classes = { }; - objectVersion = 70; + objectVersion = 50; objects = { /* Begin PBXBuildFile section */ @@ -70,6 +70,13 @@ name = Frameworks; sourceTree = ""; }; + 8458911C2DB1814400827993 /* Products */ = { + isa = PBXGroup; + children = ( + ); + name = Products; + sourceTree = ""; + }; /* End PBXGroup section */ /* Begin PBXNativeTarget section */ @@ -123,6 +130,12 @@ minimizedProjectReferenceProxies = 1; productRefGroup = 842D547F2DA712C200D3528B /* Products */; projectDirPath = ""; + projectReferences = ( + { + ProductGroup = 8458911C2DB1814400827993 /* Products */; + ProjectRef = 84588F612DB08C5F00827993 /* Sentry.xcodeproj */; + }, + ); projectRoot = ""; targets = ( 842D547D2DA712C200D3528B /* SentrySampleShared-Swift */, diff --git a/Samples/SessionReplay-CameraTest/SessionReplay-CameraTest.xcodeproj/project.pbxproj b/Samples/SessionReplay-CameraTest/SessionReplay-CameraTest.xcodeproj/project.pbxproj index d3026cbdc7e..e95ad2d8861 100644 --- a/Samples/SessionReplay-CameraTest/SessionReplay-CameraTest.xcodeproj/project.pbxproj +++ b/Samples/SessionReplay-CameraTest/SessionReplay-CameraTest.xcodeproj/project.pbxproj @@ -3,7 +3,7 @@ archiveVersion = 1; classes = { }; - objectVersion = 77; + objectVersion = 50; objects = { /* Begin PBXBuildFile section */ diff --git a/Samples/iOS-Cocoapods-Swift6/iOS-Cocoapods-Swift6.xcodeproj/project.pbxproj b/Samples/iOS-Cocoapods-Swift6/iOS-Cocoapods-Swift6.xcodeproj/project.pbxproj index b89b8f02e19..717ae0e9a7d 100644 --- a/Samples/iOS-Cocoapods-Swift6/iOS-Cocoapods-Swift6.xcodeproj/project.pbxproj +++ b/Samples/iOS-Cocoapods-Swift6/iOS-Cocoapods-Swift6.xcodeproj/project.pbxproj @@ -3,7 +3,7 @@ archiveVersion = 1; classes = { }; - objectVersion = 77; + objectVersion = 50; objects = { /* Begin PBXBuildFile section */ diff --git a/Samples/iOS-Swift/iOS-Swift.xcodeproj/project.pbxproj b/Samples/iOS-Swift/iOS-Swift.xcodeproj/project.pbxproj index 73088f4c9e1..c004aa8637b 100644 --- a/Samples/iOS-Swift/iOS-Swift.xcodeproj/project.pbxproj +++ b/Samples/iOS-Swift/iOS-Swift.xcodeproj/project.pbxproj @@ -3,7 +3,7 @@ archiveVersion = 1; classes = { }; - objectVersion = 60; + objectVersion = 50; objects = { /* Begin PBXBuildFile section */ diff --git a/Samples/iOS15-SwiftUI/iOS15-SwiftUI.xcodeproj/project.pbxproj b/Samples/iOS15-SwiftUI/iOS15-SwiftUI.xcodeproj/project.pbxproj index 9b97944520b..90e3dd7119a 100644 --- a/Samples/iOS15-SwiftUI/iOS15-SwiftUI.xcodeproj/project.pbxproj +++ b/Samples/iOS15-SwiftUI/iOS15-SwiftUI.xcodeproj/project.pbxproj @@ -3,7 +3,7 @@ archiveVersion = 1; classes = { }; - objectVersion = 55; + objectVersion = 50; objects = { /* Begin PBXBuildFile section */ diff --git a/Samples/macOS-SwiftUI/macOS-SwiftUI.xcodeproj/project.pbxproj b/Samples/macOS-SwiftUI/macOS-SwiftUI.xcodeproj/project.pbxproj index 0da4564fd3a..2e0392becc9 100644 --- a/Samples/macOS-SwiftUI/macOS-SwiftUI.xcodeproj/project.pbxproj +++ b/Samples/macOS-SwiftUI/macOS-SwiftUI.xcodeproj/project.pbxproj @@ -3,7 +3,7 @@ archiveVersion = 1; classes = { }; - objectVersion = 77; + objectVersion = 50; objects = { /* Begin PBXBuildFile section */ diff --git a/Samples/visionOS-Swift/visionOS-Swift.xcodeproj/project.pbxproj b/Samples/visionOS-Swift/visionOS-Swift.xcodeproj/project.pbxproj index 84ad6f856b9..65781630acf 100644 --- a/Samples/visionOS-Swift/visionOS-Swift.xcodeproj/project.pbxproj +++ b/Samples/visionOS-Swift/visionOS-Swift.xcodeproj/project.pbxproj @@ -3,7 +3,7 @@ archiveVersion = 1; classes = { }; - objectVersion = 56; + objectVersion = 50; objects = { /* Begin PBXBuildFile section */ diff --git a/Sentry.xcodeproj/project.pbxproj b/Sentry.xcodeproj/project.pbxproj index 06a50d67c0d..45ae2d55a2e 100644 --- a/Sentry.xcodeproj/project.pbxproj +++ b/Sentry.xcodeproj/project.pbxproj @@ -3,7 +3,7 @@ archiveVersion = 1; classes = { }; - objectVersion = 55; + objectVersion = 50; objects = { /* Begin PBXBuildFile section */ diff --git a/TestSamples/SwiftUITestSample/SwiftUITestSample.xcodeproj/project.pbxproj b/TestSamples/SwiftUITestSample/SwiftUITestSample.xcodeproj/project.pbxproj index b9cff85c4be..b79ad6ec3e0 100644 --- a/TestSamples/SwiftUITestSample/SwiftUITestSample.xcodeproj/project.pbxproj +++ b/TestSamples/SwiftUITestSample/SwiftUITestSample.xcodeproj/project.pbxproj @@ -3,7 +3,7 @@ archiveVersion = 1; classes = { }; - objectVersion = 70; + objectVersion = 50; objects = { /* Begin PBXBuildFile section */ diff --git a/Tests/DuplicatedSDKTest/DuplicatedSDKTest.xcodeproj/project.pbxproj b/Tests/DuplicatedSDKTest/DuplicatedSDKTest.xcodeproj/project.pbxproj index 6c8bb740b94..d55fb812168 100644 --- a/Tests/DuplicatedSDKTest/DuplicatedSDKTest.xcodeproj/project.pbxproj +++ b/Tests/DuplicatedSDKTest/DuplicatedSDKTest.xcodeproj/project.pbxproj @@ -3,7 +3,7 @@ archiveVersion = 1; classes = { }; - objectVersion = 77; + objectVersion = 50; objects = { /* Begin PBXBuildFile section */ diff --git a/Tests/Perf/test-app-plain/test-app-plain.xcodeproj/project.pbxproj b/Tests/Perf/test-app-plain/test-app-plain.xcodeproj/project.pbxproj index 1540fd347da..80757622de7 100644 --- a/Tests/Perf/test-app-plain/test-app-plain.xcodeproj/project.pbxproj +++ b/Tests/Perf/test-app-plain/test-app-plain.xcodeproj/project.pbxproj @@ -3,7 +3,7 @@ archiveVersion = 1; classes = { }; - objectVersion = 55; + objectVersion = 50; objects = { /* Begin PBXBuildFile section */ diff --git a/Tests/Perf/test-app-sentry/test-app-sentry.xcodeproj/project.pbxproj b/Tests/Perf/test-app-sentry/test-app-sentry.xcodeproj/project.pbxproj index 1669c6f8ac1..4d5fa94b04d 100644 --- a/Tests/Perf/test-app-sentry/test-app-sentry.xcodeproj/project.pbxproj +++ b/Tests/Perf/test-app-sentry/test-app-sentry.xcodeproj/project.pbxproj @@ -3,7 +3,7 @@ archiveVersion = 1; classes = { }; - objectVersion = 55; + objectVersion = 50; objects = { /* Begin PBXBuildFile section */ From 93b01e64bdec88b134444fbed2b9989c02df98f4 Mon Sep 17 00:00:00 2001 From: Andrew McKnight Date: Thu, 17 Apr 2025 10:50:53 -0800 Subject: [PATCH 28/35] make a couple more easy moves to the shared wrapper --- .../Extensions/SpanExtension.swift | 2 +- .../Extensions/UIViewExtension.swift | 2 +- .../project.pbxproj | 3 +- .../iOS-Swift.xcodeproj/project.pbxproj | 34 ++++--------------- .../UIViewControllerExtension.swift | 0 5 files changed, 10 insertions(+), 31 deletions(-) rename Samples/{iOS-Swift/iOS-Swift => SentrySampleShared-Swift/SentrySampleShared-Swift}/Extensions/SpanExtension.swift (96%) rename Samples/{iOS-Swift/iOS-Swift => SentrySampleShared-Swift/SentrySampleShared-Swift}/Extensions/UIViewExtension.swift (97%) rename Samples/iOS-Swift/iOS-Swift/{Extensions => }/UIViewControllerExtension.swift (100%) diff --git a/Samples/iOS-Swift/iOS-Swift/Extensions/SpanExtension.swift b/Samples/SentrySampleShared-Swift/SentrySampleShared-Swift/Extensions/SpanExtension.swift similarity index 96% rename from Samples/iOS-Swift/iOS-Swift/Extensions/SpanExtension.swift rename to Samples/SentrySampleShared-Swift/SentrySampleShared-Swift/Extensions/SpanExtension.swift index 34a71b57106..4e8bc2cc457 100644 --- a/Samples/iOS-Swift/iOS-Swift/Extensions/SpanExtension.swift +++ b/Samples/SentrySampleShared-Swift/SentrySampleShared-Swift/Extensions/SpanExtension.swift @@ -1,7 +1,7 @@ import Foundation import Sentry -extension Span { +public extension Span { //If span is a transaction it has a list of children func children() -> [Span]? { diff --git a/Samples/iOS-Swift/iOS-Swift/Extensions/UIViewExtension.swift b/Samples/SentrySampleShared-Swift/SentrySampleShared-Swift/Extensions/UIViewExtension.swift similarity index 97% rename from Samples/iOS-Swift/iOS-Swift/Extensions/UIViewExtension.swift rename to Samples/SentrySampleShared-Swift/SentrySampleShared-Swift/Extensions/UIViewExtension.swift index 9124dd3cca5..f3b2eebc536 100644 --- a/Samples/iOS-Swift/iOS-Swift/Extensions/UIViewExtension.swift +++ b/Samples/SentrySampleShared-Swift/SentrySampleShared-Swift/Extensions/UIViewExtension.swift @@ -1,7 +1,7 @@ import Foundation import UIKit -extension UIView { +public extension UIView { /// A shortcut to disable `translatesAutoresizingMaskIntoConstraints` /// - Returns: self func forAutoLayout() -> Self { diff --git a/Samples/SentrySampleShared-Swift/SentrySampleShared.xcodeproj/project.pbxproj b/Samples/SentrySampleShared-Swift/SentrySampleShared.xcodeproj/project.pbxproj index 6f5e3769923..87ed87c928c 100644 --- a/Samples/SentrySampleShared-Swift/SentrySampleShared.xcodeproj/project.pbxproj +++ b/Samples/SentrySampleShared-Swift/SentrySampleShared.xcodeproj/project.pbxproj @@ -3,7 +3,7 @@ archiveVersion = 1; classes = { }; - objectVersion = 50; + objectVersion = 70; objects = { /* Begin PBXBuildFile section */ @@ -108,7 +108,6 @@ 842D54762DA712C200D3528B /* Project object */ = { isa = PBXProject; attributes = { - BuildIndependentTargetsInParallel = 1; LastSwiftUpdateCheck = 1620; LastUpgradeCheck = 1620; TargetAttributes = { diff --git a/Samples/iOS-Swift/iOS-Swift.xcodeproj/project.pbxproj b/Samples/iOS-Swift/iOS-Swift.xcodeproj/project.pbxproj index c004aa8637b..1ac9b371b14 100644 --- a/Samples/iOS-Swift/iOS-Swift.xcodeproj/project.pbxproj +++ b/Samples/iOS-Swift/iOS-Swift.xcodeproj/project.pbxproj @@ -3,7 +3,7 @@ archiveVersion = 1; classes = { }; - objectVersion = 50; + objectVersion = 60; objects = { /* Begin PBXBuildFile section */ @@ -36,6 +36,8 @@ 842D54B12DA7169800D3528B /* libSentrySampleShared-Swift.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 842D549F2DA712ED00D3528B /* libSentrySampleShared-Swift.a */; }; 844DA821282584C300E6B62E /* CoreDataViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = D8F57BC427BBD787000D09D4 /* CoreDataViewController.swift */; }; 844DA822282584F700E6B62E /* SentryData.xcdatamodeld in Sources */ = {isa = PBXBuildFile; fileRef = D845F35927BAD4CC00A4D7A2 /* SentryData.xcdatamodeld */; }; + 845892202DB1849A00827993 /* UIViewControllerExtension.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8458921F2DB1849A00827993 /* UIViewControllerExtension.swift */; }; + 845892212DB1849A00827993 /* UIViewControllerExtension.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8458921F2DB1849A00827993 /* UIViewControllerExtension.swift */; }; 847670302BAA4AFA001A4E31 /* NSObject+SentryAppSetup.m in Sources */ = {isa = PBXBuildFile; fileRef = 8476702F2BAA4AFA001A4E31 /* NSObject+SentryAppSetup.m */; }; 848A256D286E3351008A8858 /* fatal-error-binary-images-message2.json in Resources */ = {isa = PBXBuildFile; fileRef = D83A30DF279F1F5C00372D0A /* fatal-error-binary-images-message2.json */; }; 849C4A692D66CA1600FA632D /* screenshot.png in Resources */ = {isa = PBXBuildFile; fileRef = 849C4A682D66CA1600FA632D /* screenshot.png */; }; @@ -81,13 +83,9 @@ D840D52F273A07F600CDF142 /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = D840D52D273A07F600CDF142 /* LaunchScreen.storyboard */; }; D840D534273A07F600CDF142 /* iOS-SwiftClip.app in Embed App Clips */ = {isa = PBXBuildFile; fileRef = D840D520273A07F400CDF142 /* iOS-SwiftClip.app */; platformFilter = ios; settings = {ATTRIBUTES = (RemoveHeadersOnCopy, ); }; }; D840D53C273A08F100CDF142 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = D840D53B273A08F100CDF142 /* Assets.xcassets */; }; - D8444E4C275E38090042F4DE /* UIViewControllerExtension.swift in Sources */ = {isa = PBXBuildFile; fileRef = D8444E4B275E38090042F4DE /* UIViewControllerExtension.swift */; }; D8444E51275F79240042F4DE /* AssertView.swift in Sources */ = {isa = PBXBuildFile; fileRef = D8F3D05E274E6A8B00B56F8C /* AssertView.swift */; }; D8444E53275F792A0042F4DE /* UIAssert.swift in Sources */ = {isa = PBXBuildFile; fileRef = D8D7BB492750067900044146 /* UIAssert.swift */; }; D8444E54275F794D0042F4DE /* SpanObserver.swift in Sources */ = {isa = PBXBuildFile; fileRef = D8D7BB4D27501B9400044146 /* SpanObserver.swift */; }; - D8444E55275F79570042F4DE /* SpanExtension.swift in Sources */ = {isa = PBXBuildFile; fileRef = D8F3D061274EBD4800B56F8C /* SpanExtension.swift */; }; - D8444E56275F79590042F4DE /* UIViewExtension.swift in Sources */ = {isa = PBXBuildFile; fileRef = D8D7BB4B2750095800044146 /* UIViewExtension.swift */; }; - D8444E57275F795D0042F4DE /* UIViewControllerExtension.swift in Sources */ = {isa = PBXBuildFile; fileRef = D8444E4B275E38090042F4DE /* UIViewControllerExtension.swift */; }; D845F35B27BAD4CC00A4D7A2 /* SentryData.xcdatamodeld in Sources */ = {isa = PBXBuildFile; fileRef = D845F35927BAD4CC00A4D7A2 /* SentryData.xcdatamodeld */; }; D85DAA4C274C244F004DF43C /* LaunchUITest.swift in Sources */ = {isa = PBXBuildFile; fileRef = D85DAA4B274C244F004DF43C /* LaunchUITest.swift */; }; D86B9C972CDD11430039211C /* Sentry.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = D86B9C962CDD11430039211C /* Sentry.framework */; }; @@ -116,7 +114,6 @@ D8C33E2629FBB8D90071B75A /* UIEventBreadcrumbTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = D8C33E2529FBB8D90071B75A /* UIEventBreadcrumbTests.swift */; }; D8C484852CCF902F00503B14 /* SampleAssets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 62C97DB92CC69B0200DDA204 /* SampleAssets.xcassets */; }; D8D7BB4A2750067900044146 /* UIAssert.swift in Sources */ = {isa = PBXBuildFile; fileRef = D8D7BB492750067900044146 /* UIAssert.swift */; }; - D8D7BB4C2750095800044146 /* UIViewExtension.swift in Sources */ = {isa = PBXBuildFile; fileRef = D8D7BB4B2750095800044146 /* UIViewExtension.swift */; }; D8D7BB4E27501B9400044146 /* SpanObserver.swift in Sources */ = {isa = PBXBuildFile; fileRef = D8D7BB4D27501B9400044146 /* SpanObserver.swift */; }; D8DA29042C7F2199008BC825 /* SRRedactSampleViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = D8DA29032C7F2199008BC825 /* SRRedactSampleViewController.swift */; }; D8DBDA76274D591F00007380 /* TableViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = D8DBDA75274D591F00007380 /* TableViewController.swift */; }; @@ -127,7 +124,6 @@ D8F3D057274E574200B56F8C /* LoremIpsumViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = D8F3D056274E574200B56F8C /* LoremIpsumViewController.swift */; }; D8F3D058274E57D600B56F8C /* TableViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = D8DBDA75274D591F00007380 /* TableViewController.swift */; }; D8F3D05F274E6A8B00B56F8C /* AssertView.swift in Sources */ = {isa = PBXBuildFile; fileRef = D8F3D05E274E6A8B00B56F8C /* AssertView.swift */; }; - D8F3D062274EBD4800B56F8C /* SpanExtension.swift in Sources */ = {isa = PBXBuildFile; fileRef = D8F3D061274EBD4800B56F8C /* SpanExtension.swift */; }; D8F57BC527BBD787000D09D4 /* CoreDataViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = D8F57BC427BBD787000D09D4 /* CoreDataViewController.swift */; }; D8F71A4F2CDD03B900334022 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = D8F71A4E2CDD03B900334022 /* AppDelegate.swift */; }; D8F71A512CDD03B900334022 /* SceneDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = D8F71A502CDD03B900334022 /* SceneDelegate.swift */; }; @@ -318,6 +314,7 @@ 841C8A222DA7273400DCA74F /* LaunchArgumentTableViewCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LaunchArgumentTableViewCell.swift; sourceTree = ""; }; 841C8A252DA7273E00DCA74F /* EnvironmentVariableTableViewCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = EnvironmentVariableTableViewCell.swift; sourceTree = ""; }; 842D54882DA712E700D3528B /* SentrySampleShared.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = SentrySampleShared.xcodeproj; path = "../SentrySampleShared-Swift/SentrySampleShared.xcodeproj"; sourceTree = SOURCE_ROOT; }; + 8458921F2DB1849A00827993 /* UIViewControllerExtension.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = UIViewControllerExtension.swift; sourceTree = ""; }; 8476702E2BAA4AFA001A4E31 /* NSObject+SentryAppSetup.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "NSObject+SentryAppSetup.h"; sourceTree = ""; }; 8476702F2BAA4AFA001A4E31 /* NSObject+SentryAppSetup.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = "NSObject+SentryAppSetup.m"; sourceTree = ""; }; 848A2573286E3351008A8858 /* PerformanceBenchmarks.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = PerformanceBenchmarks.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; @@ -361,7 +358,6 @@ D840D530273A07F600CDF142 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; D840D531273A07F600CDF142 /* iOS_SwiftClip.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = iOS_SwiftClip.entitlements; sourceTree = ""; }; D840D53B273A08F100CDF142 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; - D8444E4B275E38090042F4DE /* UIViewControllerExtension.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = UIViewControllerExtension.swift; sourceTree = ""; }; D845F35A27BAD4CC00A4D7A2 /* Person.xcdatamodel */ = {isa = PBXFileReference; lastKnownFileType = wrapper.xcdatamodel; path = Person.xcdatamodel; sourceTree = ""; }; D85DAA49274C244F004DF43C /* iOS13-SwiftTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = "iOS13-SwiftTests.xctest"; sourceTree = BUILT_PRODUCTS_DIR; }; D85DAA4B274C244F004DF43C /* LaunchUITest.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LaunchUITest.swift; sourceTree = ""; }; @@ -382,7 +378,6 @@ D8C33E1E29FBB1F70071B75A /* UIEventBreadcrumbsController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = UIEventBreadcrumbsController.swift; sourceTree = ""; }; D8C33E2529FBB8D90071B75A /* UIEventBreadcrumbTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = UIEventBreadcrumbTests.swift; sourceTree = ""; }; D8D7BB492750067900044146 /* UIAssert.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = UIAssert.swift; sourceTree = ""; }; - D8D7BB4B2750095800044146 /* UIViewExtension.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = UIViewExtension.swift; sourceTree = ""; }; D8D7BB4D27501B9400044146 /* SpanObserver.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SpanObserver.swift; sourceTree = ""; }; D8DA29032C7F2199008BC825 /* SRRedactSampleViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SRRedactSampleViewController.swift; sourceTree = ""; }; D8DBDA75274D591F00007380 /* TableViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TableViewController.swift; sourceTree = ""; }; @@ -392,7 +387,6 @@ D8F3D051274E572F00B56F8C /* RandomErrors.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = RandomErrors.swift; sourceTree = ""; }; D8F3D056274E574200B56F8C /* LoremIpsumViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = LoremIpsumViewController.swift; sourceTree = ""; }; D8F3D05E274E6A8B00B56F8C /* AssertView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AssertView.swift; sourceTree = ""; }; - D8F3D061274EBD4800B56F8C /* SpanExtension.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SpanExtension.swift; sourceTree = ""; }; D8F57BC427BBD787000D09D4 /* CoreDataViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CoreDataViewController.swift; sourceTree = ""; }; D8F71A4C2CDD03B900334022 /* iOS-Swift6.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = "iOS-Swift6.app"; sourceTree = BUILT_PRODUCTS_DIR; }; D8F71A4E2CDD03B900334022 /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; }; @@ -528,7 +522,6 @@ 637AFDA8243B02760034958B /* iOS-Swift */ = { isa = PBXGroup; children = ( - D8F3D060274EBD3000B56F8C /* Extensions */, D8F3D05C274E6A5700B56F8C /* View */, D8DBDA74274D4E1600007380 /* Tools */, D8DBDA73274D4DF900007380 /* ViewControllers */, @@ -548,6 +541,7 @@ 841C8A1F2DA7266E00DCA74F /* FeaturesViewController.swift */, 841C8A222DA7273400DCA74F /* LaunchArgumentTableViewCell.swift */, 841C8A252DA7273E00DCA74F /* EnvironmentVariableTableViewCell.swift */, + 8458921F2DB1849A00827993 /* UIViewControllerExtension.swift */, ); path = "iOS-Swift"; sourceTree = ""; @@ -702,16 +696,6 @@ path = View; sourceTree = ""; }; - D8F3D060274EBD3000B56F8C /* Extensions */ = { - isa = PBXGroup; - children = ( - D8F3D061274EBD4800B56F8C /* SpanExtension.swift */, - D8D7BB4B2750095800044146 /* UIViewExtension.swift */, - D8444E4B275E38090042F4DE /* UIViewControllerExtension.swift */, - ); - path = Extensions; - sourceTree = ""; - }; D8F71A4D2CDD03B900334022 /* iOS-Swift6 */ = { isa = PBXGroup; children = ( @@ -1185,14 +1169,12 @@ D8F3D05F274E6A8B00B56F8C /* AssertView.swift in Sources */, D890CD3F26CEE31B001246CF /* NibViewController.swift in Sources */, D845F35B27BAD4CC00A4D7A2 /* SentryData.xcdatamodeld in Sources */, - D8444E4C275E38090042F4DE /* UIViewControllerExtension.swift in Sources */, 637AFDAE243B02760034958B /* TransactionsViewController.swift in Sources */, D8832B132AF4F7FE00C522B0 /* TopViewControllerInspector.swift in Sources */, D8DA29042C7F2199008BC825 /* SRRedactSampleViewController.swift in Sources */, 0AABE2EA28855FF80057ED69 /* PermissionsViewController.swift in Sources */, 84BA71E42C8BBBEC0045B828 /* DSNDisplayViewController.swift in Sources */, 7B5525B32938B5B5006A2932 /* DiskWriteException.swift in Sources */, - D8F3D062274EBD4800B56F8C /* SpanExtension.swift in Sources */, 637AFDAA243B02760034958B /* AppDelegate.swift in Sources */, D8F57BC527BBD787000D09D4 /* CoreDataViewController.swift in Sources */, D8D7BB4E27501B9400044146 /* SpanObserver.swift in Sources */, @@ -1200,6 +1182,7 @@ D8832B1E2AF52D0500C522B0 /* PageViewController.swift in Sources */, D8DBDA76274D591F00007380 /* TableViewController.swift in Sources */, D8C33E1F29FBB1F70071B75A /* UIEventBreadcrumbsController.swift in Sources */, + 845892212DB1849A00827993 /* UIViewControllerExtension.swift in Sources */, 8E8C57AF25EF16E6001CEEFA /* TraceTestViewController.swift in Sources */, 841C8A202DA7266E00DCA74F /* FeaturesViewController.swift in Sources */, 84AB90712A5001000054C99A /* ProfilingViewController.swift in Sources */, @@ -1210,7 +1193,6 @@ D8F3D054274E572F00B56F8C /* RandomErrors.swift in Sources */, 841C8A232DA7273400DCA74F /* LaunchArgumentTableViewCell.swift in Sources */, D80D021329EE93630084393D /* ErrorsViewController.swift in Sources */, - D8D7BB4C2750095800044146 /* UIViewExtension.swift in Sources */, 7B79000429028C7300A7F467 /* MetricKitManager.swift in Sources */, D8D7BB4A2750067900044146 /* UIAssert.swift in Sources */, D8F3D057274E574200B56F8C /* LoremIpsumViewController.swift in Sources */, @@ -1260,21 +1242,19 @@ 841C8A242DA7273400DCA74F /* LaunchArgumentTableViewCell.swift in Sources */, D8AE48CF2C57E0BD0092A2A6 /* WebViewController.swift in Sources */, 84BA71F22C8F73FD0045B828 /* DSNDisplayViewController.swift in Sources */, - D8444E56275F79590042F4DE /* UIViewExtension.swift in Sources */, D8269A57274C0FA100BD5BD5 /* NibViewController.swift in Sources */, D8269A4E274C09A400BD5BD5 /* SwiftUIViewController.swift in Sources */, D8269A4F274C09A400BD5BD5 /* SwiftUIView.swift in Sources */, - D8444E57275F795D0042F4DE /* UIViewControllerExtension.swift in Sources */, 924857562C89A86300774AC3 /* MainViewController.swift in Sources */, D8F3D058274E57D600B56F8C /* TableViewController.swift in Sources */, 7B5525B62938B644006A2932 /* DiskWriteException.swift in Sources */, D8269A58274C0FC700BD5BD5 /* TransactionsViewController.swift in Sources */, 844DA821282584C300E6B62E /* CoreDataViewController.swift in Sources */, - D8444E55275F79570042F4DE /* SpanExtension.swift in Sources */, D8832B1F2AF535B200C522B0 /* PageViewController.swift in Sources */, D8444E51275F79240042F4DE /* AssertView.swift in Sources */, 844DA822282584F700E6B62E /* SentryData.xcdatamodeld in Sources */, 84FB812B284001B800F3A94A /* SentryBenchmarking.mm in Sources */, + 845892202DB1849A00827993 /* UIViewControllerExtension.swift in Sources */, D8F3D055274E572F00B56F8C /* RandomErrors.swift in Sources */, 0AAAB8572887F7C60011845C /* PermissionsViewController.swift in Sources */, D8269A3C274C095E00BD5BD5 /* AppDelegate.swift in Sources */, diff --git a/Samples/iOS-Swift/iOS-Swift/Extensions/UIViewControllerExtension.swift b/Samples/iOS-Swift/iOS-Swift/UIViewControllerExtension.swift similarity index 100% rename from Samples/iOS-Swift/iOS-Swift/Extensions/UIViewControllerExtension.swift rename to Samples/iOS-Swift/iOS-Swift/UIViewControllerExtension.swift From f1f54b0a413cb0c463b9e3e675b8a34b2a575179 Mon Sep 17 00:00:00 2001 From: Andrew McKnight Date: Thu, 17 Apr 2025 11:01:05 -0800 Subject: [PATCH 29/35] fixup! try overwriting all objectVersion numbers to the earliest one that originally appeared --- .../SentrySampleShared.xcodeproj/project.pbxproj | 2 +- Samples/iOS-Swift/iOS-Swift.xcodeproj/project.pbxproj | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Samples/SentrySampleShared-Swift/SentrySampleShared.xcodeproj/project.pbxproj b/Samples/SentrySampleShared-Swift/SentrySampleShared.xcodeproj/project.pbxproj index 87ed87c928c..3e76905fd2c 100644 --- a/Samples/SentrySampleShared-Swift/SentrySampleShared.xcodeproj/project.pbxproj +++ b/Samples/SentrySampleShared-Swift/SentrySampleShared.xcodeproj/project.pbxproj @@ -3,7 +3,7 @@ archiveVersion = 1; classes = { }; - objectVersion = 70; + objectVersion = 50; objects = { /* Begin PBXBuildFile section */ diff --git a/Samples/iOS-Swift/iOS-Swift.xcodeproj/project.pbxproj b/Samples/iOS-Swift/iOS-Swift.xcodeproj/project.pbxproj index 1ac9b371b14..782ae6ee9be 100644 --- a/Samples/iOS-Swift/iOS-Swift.xcodeproj/project.pbxproj +++ b/Samples/iOS-Swift/iOS-Swift.xcodeproj/project.pbxproj @@ -3,7 +3,7 @@ archiveVersion = 1; classes = { }; - objectVersion = 60; + objectVersion = 50; objects = { /* Begin PBXBuildFile section */ From 89cc935a686b7f8015e54bece6f5875f99e1bef6 Mon Sep 17 00:00:00 2001 From: Andrew McKnight Date: Thu, 17 Apr 2025 11:10:32 -0800 Subject: [PATCH 30/35] ci: use latest macos with default xcode to build sample apps --- .github/workflows/build.yml | 25 +++---------------------- 1 file changed, 3 insertions(+), 22 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index dc0b9ef7356..b85df6826bf 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -50,41 +50,22 @@ jobs: build-sample: name: Sample ${{ matrix.scheme }} - runs-on: ${{ matrix.runs-on }} + runs-on: macos-latest strategy: fail-fast: false matrix: # other sample projects are built in ui-tests include: - scheme: macOS-Swift - xcode: 15.4 - runs-on: macos-14 - scheme: iOS13-Swift - xcode: 15.4 - runs-on: macos-14 - scheme: watchOS-Swift WatchKit App - xcode: 15.4 - runs-on: macos-14 - # Only compiles on Xcode 16+ - scheme: macOS-SwiftUI - xcode: 16.2 - runs-on: macos-15 - - scheme: SessionReplay-CameraTest - xcode: 16.2 - runs-on: macos-15 - - # We have to compile on Xcode 16.3 because compiling on Xcode 16.2 fails with - # Data+SentryTracing.swift:21:62: error: 'ReadingOptions' aliases 'Foundation.ReadingOptions' - # and cannot be used here because C++ types from imported module 'Foundation' do not support - # library evolution; this is an error in the Swift 6 language mode - scheme: visionOS-Swift - xcode: 16.3 - runs-on: macos-15 steps: - uses: actions/checkout@v4 - - run: ./scripts/ci-select-xcode.sh ${{ matrix.xcode }} + - run: ./scripts/ci-select-xcode.sh 16.3 - name: List Xcode Build Schemes run: >- @@ -107,7 +88,7 @@ jobs: uses: actions/upload-artifact@v4 if: ${{ failure() || cancelled() }} with: - name: raw-build-output-os-${{matrix.runs-on}}-xcode-${{matrix.xcode}}-scheme-${{matrix.scheme}} + name: raw-build-output-scheme-${{matrix.scheme}} path: | raw-build-output.log From 4f477dedf38fe8933fc4c95fa3b1cbe3a16f14c2 Mon Sep 17 00:00:00 2001 From: Andrew McKnight Date: Thu, 17 Apr 2025 11:10:46 -0800 Subject: [PATCH 31/35] ci: dont specify a default xcode value inside the script --- scripts/ci-select-xcode.sh | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/scripts/ci-select-xcode.sh b/scripts/ci-select-xcode.sh index 1021fd01340..ad6b81715d1 100755 --- a/scripts/ci-select-xcode.sh +++ b/scripts/ci-select-xcode.sh @@ -7,8 +7,7 @@ set -euo pipefail -# 14.3 is the default -XCODE_VERSION="${1:-14.3}" +XCODE_VERSION="${1}" # We prefer this over calling `sudo xcode-select` because it will fail if the Xcode version # is not installed. Also xcodes is preinstalled on the GH runners. From 15cec747a4ea6c4ac5518c494165fe74a48edb14 Mon Sep 17 00:00:00 2001 From: Andrew McKnight Date: Thu, 17 Apr 2025 11:14:59 -0800 Subject: [PATCH 32/35] use macos-15 --- .github/workflows/build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index b85df6826bf..73a760257eb 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -50,7 +50,7 @@ jobs: build-sample: name: Sample ${{ matrix.scheme }} - runs-on: macos-latest + runs-on: macos-15 strategy: fail-fast: false matrix: From 461996a27a505476a6e8f80dab3274ef3354e200 Mon Sep 17 00:00:00 2001 From: Andrew McKnight Date: Thu, 17 Apr 2025 11:22:56 -0800 Subject: [PATCH 33/35] also for iOS-Swift; remove the step that just lists schemes --- .github/workflows/build.yml | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 73a760257eb..29d40f6e4c1 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -29,10 +29,10 @@ jobs: # With this we catch potential issues already in the PR. ios-swift-release: name: Release Build of iOS Swift - runs-on: macos-14 + runs-on: macos15 steps: - uses: actions/checkout@v4 - - run: ./scripts/ci-select-xcode.sh 16.2 + - run: ./scripts/ci-select-xcode.sh 16.3 - uses: ruby/setup-ruby@v1 with: bundler-cache: true @@ -67,12 +67,6 @@ jobs: - uses: actions/checkout@v4 - run: ./scripts/ci-select-xcode.sh 16.3 - - name: List Xcode Build Schemes - run: >- - xcodebuild - -workspace Sentry.xcworkspace - -list - # Note: Due to complexity in implementing the CODE_SIGNING_ALLOWED flag in the sentry-xcodebuild.sh script, # we did not yet migrate this step to use the script yet. - run: >- From ab525049ffbeb6f61ccfef8e26a9f2eb9c2b541f Mon Sep 17 00:00:00 2001 From: Andrew McKnight Date: Thu, 17 Apr 2025 12:00:44 -0800 Subject: [PATCH 34/35] Revert "fixup! try overwriting all objectVersion numbers to the earliest one that originally appeared" This reverts commit f1f54b0a413cb0c463b9e3e675b8a34b2a575179. --- .../SentrySampleShared.xcodeproj/project.pbxproj | 2 +- Samples/iOS-Swift/iOS-Swift.xcodeproj/project.pbxproj | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Samples/SentrySampleShared-Swift/SentrySampleShared.xcodeproj/project.pbxproj b/Samples/SentrySampleShared-Swift/SentrySampleShared.xcodeproj/project.pbxproj index 3e76905fd2c..87ed87c928c 100644 --- a/Samples/SentrySampleShared-Swift/SentrySampleShared.xcodeproj/project.pbxproj +++ b/Samples/SentrySampleShared-Swift/SentrySampleShared.xcodeproj/project.pbxproj @@ -3,7 +3,7 @@ archiveVersion = 1; classes = { }; - objectVersion = 50; + objectVersion = 70; objects = { /* Begin PBXBuildFile section */ diff --git a/Samples/iOS-Swift/iOS-Swift.xcodeproj/project.pbxproj b/Samples/iOS-Swift/iOS-Swift.xcodeproj/project.pbxproj index 782ae6ee9be..1ac9b371b14 100644 --- a/Samples/iOS-Swift/iOS-Swift.xcodeproj/project.pbxproj +++ b/Samples/iOS-Swift/iOS-Swift.xcodeproj/project.pbxproj @@ -3,7 +3,7 @@ archiveVersion = 1; classes = { }; - objectVersion = 50; + objectVersion = 60; objects = { /* Begin PBXBuildFile section */ From 26096768fb12c9d82956ba818b06594b3ed0cd8a Mon Sep 17 00:00:00 2001 From: Andrew McKnight Date: Thu, 17 Apr 2025 12:00:50 -0800 Subject: [PATCH 35/35] Revert "try overwriting all objectVersion numbers to the earliest one that originally appeared" This reverts commit 74251ff27002e7989ff2e4390a75dd438e7ded2c. --- .../XCFramework.xcodeproj/project.pbxproj | 2 +- .../SentrySampleShared.xcodeproj/project.pbxproj | 13 ------------- .../project.pbxproj | 2 +- .../iOS-Cocoapods-Swift6.xcodeproj/project.pbxproj | 2 +- .../iOS15-SwiftUI.xcodeproj/project.pbxproj | 2 +- .../macOS-SwiftUI.xcodeproj/project.pbxproj | 2 +- .../visionOS-Swift.xcodeproj/project.pbxproj | 2 +- Sentry.xcodeproj/project.pbxproj | 2 +- .../SwiftUITestSample.xcodeproj/project.pbxproj | 2 +- .../DuplicatedSDKTest.xcodeproj/project.pbxproj | 2 +- .../test-app-plain.xcodeproj/project.pbxproj | 2 +- .../test-app-sentry.xcodeproj/project.pbxproj | 2 +- 12 files changed, 11 insertions(+), 24 deletions(-) diff --git a/Samples/Carthage-Validation/XCFramework/XCFramework.xcodeproj/project.pbxproj b/Samples/Carthage-Validation/XCFramework/XCFramework.xcodeproj/project.pbxproj index 83b88fe62d8..2809479991d 100644 --- a/Samples/Carthage-Validation/XCFramework/XCFramework.xcodeproj/project.pbxproj +++ b/Samples/Carthage-Validation/XCFramework/XCFramework.xcodeproj/project.pbxproj @@ -3,7 +3,7 @@ archiveVersion = 1; classes = { }; - objectVersion = 50; + objectVersion = 52; objects = { /* Begin PBXBuildFile section */ diff --git a/Samples/SentrySampleShared-Swift/SentrySampleShared.xcodeproj/project.pbxproj b/Samples/SentrySampleShared-Swift/SentrySampleShared.xcodeproj/project.pbxproj index 87ed87c928c..8c7f41e8662 100644 --- a/Samples/SentrySampleShared-Swift/SentrySampleShared.xcodeproj/project.pbxproj +++ b/Samples/SentrySampleShared-Swift/SentrySampleShared.xcodeproj/project.pbxproj @@ -70,13 +70,6 @@ name = Frameworks; sourceTree = ""; }; - 8458911C2DB1814400827993 /* Products */ = { - isa = PBXGroup; - children = ( - ); - name = Products; - sourceTree = ""; - }; /* End PBXGroup section */ /* Begin PBXNativeTarget section */ @@ -129,12 +122,6 @@ minimizedProjectReferenceProxies = 1; productRefGroup = 842D547F2DA712C200D3528B /* Products */; projectDirPath = ""; - projectReferences = ( - { - ProductGroup = 8458911C2DB1814400827993 /* Products */; - ProjectRef = 84588F612DB08C5F00827993 /* Sentry.xcodeproj */; - }, - ); projectRoot = ""; targets = ( 842D547D2DA712C200D3528B /* SentrySampleShared-Swift */, diff --git a/Samples/SessionReplay-CameraTest/SessionReplay-CameraTest.xcodeproj/project.pbxproj b/Samples/SessionReplay-CameraTest/SessionReplay-CameraTest.xcodeproj/project.pbxproj index e95ad2d8861..d3026cbdc7e 100644 --- a/Samples/SessionReplay-CameraTest/SessionReplay-CameraTest.xcodeproj/project.pbxproj +++ b/Samples/SessionReplay-CameraTest/SessionReplay-CameraTest.xcodeproj/project.pbxproj @@ -3,7 +3,7 @@ archiveVersion = 1; classes = { }; - objectVersion = 50; + objectVersion = 77; objects = { /* Begin PBXBuildFile section */ diff --git a/Samples/iOS-Cocoapods-Swift6/iOS-Cocoapods-Swift6.xcodeproj/project.pbxproj b/Samples/iOS-Cocoapods-Swift6/iOS-Cocoapods-Swift6.xcodeproj/project.pbxproj index 717ae0e9a7d..b89b8f02e19 100644 --- a/Samples/iOS-Cocoapods-Swift6/iOS-Cocoapods-Swift6.xcodeproj/project.pbxproj +++ b/Samples/iOS-Cocoapods-Swift6/iOS-Cocoapods-Swift6.xcodeproj/project.pbxproj @@ -3,7 +3,7 @@ archiveVersion = 1; classes = { }; - objectVersion = 50; + objectVersion = 77; objects = { /* Begin PBXBuildFile section */ diff --git a/Samples/iOS15-SwiftUI/iOS15-SwiftUI.xcodeproj/project.pbxproj b/Samples/iOS15-SwiftUI/iOS15-SwiftUI.xcodeproj/project.pbxproj index 90e3dd7119a..9b97944520b 100644 --- a/Samples/iOS15-SwiftUI/iOS15-SwiftUI.xcodeproj/project.pbxproj +++ b/Samples/iOS15-SwiftUI/iOS15-SwiftUI.xcodeproj/project.pbxproj @@ -3,7 +3,7 @@ archiveVersion = 1; classes = { }; - objectVersion = 50; + objectVersion = 55; objects = { /* Begin PBXBuildFile section */ diff --git a/Samples/macOS-SwiftUI/macOS-SwiftUI.xcodeproj/project.pbxproj b/Samples/macOS-SwiftUI/macOS-SwiftUI.xcodeproj/project.pbxproj index 2e0392becc9..0da4564fd3a 100644 --- a/Samples/macOS-SwiftUI/macOS-SwiftUI.xcodeproj/project.pbxproj +++ b/Samples/macOS-SwiftUI/macOS-SwiftUI.xcodeproj/project.pbxproj @@ -3,7 +3,7 @@ archiveVersion = 1; classes = { }; - objectVersion = 50; + objectVersion = 77; objects = { /* Begin PBXBuildFile section */ diff --git a/Samples/visionOS-Swift/visionOS-Swift.xcodeproj/project.pbxproj b/Samples/visionOS-Swift/visionOS-Swift.xcodeproj/project.pbxproj index 65781630acf..84ad6f856b9 100644 --- a/Samples/visionOS-Swift/visionOS-Swift.xcodeproj/project.pbxproj +++ b/Samples/visionOS-Swift/visionOS-Swift.xcodeproj/project.pbxproj @@ -3,7 +3,7 @@ archiveVersion = 1; classes = { }; - objectVersion = 50; + objectVersion = 56; objects = { /* Begin PBXBuildFile section */ diff --git a/Sentry.xcodeproj/project.pbxproj b/Sentry.xcodeproj/project.pbxproj index 45ae2d55a2e..06a50d67c0d 100644 --- a/Sentry.xcodeproj/project.pbxproj +++ b/Sentry.xcodeproj/project.pbxproj @@ -3,7 +3,7 @@ archiveVersion = 1; classes = { }; - objectVersion = 50; + objectVersion = 55; objects = { /* Begin PBXBuildFile section */ diff --git a/TestSamples/SwiftUITestSample/SwiftUITestSample.xcodeproj/project.pbxproj b/TestSamples/SwiftUITestSample/SwiftUITestSample.xcodeproj/project.pbxproj index b79ad6ec3e0..b9cff85c4be 100644 --- a/TestSamples/SwiftUITestSample/SwiftUITestSample.xcodeproj/project.pbxproj +++ b/TestSamples/SwiftUITestSample/SwiftUITestSample.xcodeproj/project.pbxproj @@ -3,7 +3,7 @@ archiveVersion = 1; classes = { }; - objectVersion = 50; + objectVersion = 70; objects = { /* Begin PBXBuildFile section */ diff --git a/Tests/DuplicatedSDKTest/DuplicatedSDKTest.xcodeproj/project.pbxproj b/Tests/DuplicatedSDKTest/DuplicatedSDKTest.xcodeproj/project.pbxproj index d55fb812168..6c8bb740b94 100644 --- a/Tests/DuplicatedSDKTest/DuplicatedSDKTest.xcodeproj/project.pbxproj +++ b/Tests/DuplicatedSDKTest/DuplicatedSDKTest.xcodeproj/project.pbxproj @@ -3,7 +3,7 @@ archiveVersion = 1; classes = { }; - objectVersion = 50; + objectVersion = 77; objects = { /* Begin PBXBuildFile section */ diff --git a/Tests/Perf/test-app-plain/test-app-plain.xcodeproj/project.pbxproj b/Tests/Perf/test-app-plain/test-app-plain.xcodeproj/project.pbxproj index 80757622de7..1540fd347da 100644 --- a/Tests/Perf/test-app-plain/test-app-plain.xcodeproj/project.pbxproj +++ b/Tests/Perf/test-app-plain/test-app-plain.xcodeproj/project.pbxproj @@ -3,7 +3,7 @@ archiveVersion = 1; classes = { }; - objectVersion = 50; + objectVersion = 55; objects = { /* Begin PBXBuildFile section */ diff --git a/Tests/Perf/test-app-sentry/test-app-sentry.xcodeproj/project.pbxproj b/Tests/Perf/test-app-sentry/test-app-sentry.xcodeproj/project.pbxproj index 4d5fa94b04d..1669c6f8ac1 100644 --- a/Tests/Perf/test-app-sentry/test-app-sentry.xcodeproj/project.pbxproj +++ b/Tests/Perf/test-app-sentry/test-app-sentry.xcodeproj/project.pbxproj @@ -3,7 +3,7 @@ archiveVersion = 1; classes = { }; - objectVersion = 50; + objectVersion = 55; objects = { /* Begin PBXBuildFile section */