Skip to content

Commit 7a57e7a

Browse files
committed
fix incorrect import of NSApplication in macCatalyst environments
1 parent 2edc82f commit 7a57e7a

File tree

5 files changed

+9
-8
lines changed

5 files changed

+9
-8
lines changed

Sources/Swift/Core/Integrations/FramesTracking/SentryFramesTracker.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
#if (os(iOS) || os(tvOS) || (swift(>=5.9) && os(visionOS))) && !SENTRY_NO_UIKIT
55
import UIKit
66
private typealias CrossPlatformApplication = UIApplication
7-
#elseif (os(macOS) || targetEnvironment(macCatalyst)) && !SENTRY_NO_UIKIT
7+
#elseif os(macOS)
88
import AppKit
99
private typealias CrossPlatformApplication = NSApplication
1010
#endif

Sources/Swift/Core/Integrations/Integrations.swift

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,11 +36,12 @@ private struct AnyIntegration {
3636
let dependencies = SentryDependencyContainer.sharedInstance()
3737

3838
var integrations: [AnyIntegration] = [.init(SwiftAsyncIntegration.self)]
39+
3940
#if os(iOS) && !SENTRY_NO_UIKIT
4041
integrations.append(.init(UserFeedbackIntegration<SentryDependencyContainer>.self))
4142
#endif
4243

43-
#if ((os(iOS) || os(tvOS) || (swift(>=5.9) && os(visionOS))) && !SENTRY_NO_UIKIT) || ((os(macOS) || targetEnvironment(macCatalyst)) && !SENTRY_NO_UIKIT)
44+
#if ((os(iOS) || os(tvOS) || (swift(>=5.9) && os(visionOS))) && !SENTRY_NO_UIKIT) || os(macOS)
4445
integrations.append(.init(FlushLogsIntegration<SentryDependencyContainer>.self))
4546
#endif
4647

Sources/Swift/Integrations/Log/FlushLogsIntegration.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,12 @@
33
#if (os(iOS) || os(tvOS) || (swift(>=5.9) && os(visionOS))) && !SENTRY_NO_UIKIT
44
import UIKit
55
private typealias CrossPlatformApplication = UIApplication
6-
#elseif (os(macOS) || targetEnvironment(macCatalyst)) && !SENTRY_NO_UIKIT
6+
#elseif os(macOS)
77
import AppKit
88
private typealias CrossPlatformApplication = NSApplication
99
#endif
1010

11-
#if ((os(iOS) || os(tvOS) || (swift(>=5.9) && os(visionOS))) && !SENTRY_NO_UIKIT) || ((os(macOS) || targetEnvironment(macCatalyst)) && !SENTRY_NO_UIKIT)
11+
#if ((os(iOS) || os(tvOS) || (swift(>=5.9) && os(visionOS))) && !SENTRY_NO_UIKIT) || os(macOS)
1212

1313
protocol NotificationCenterProvider {
1414
var notificationCenterWrapper: SentryNSNotificationCenterWrapper { get }

Sources/Swift/Integrations/Session/SessionTracker.swift

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
#if (os(iOS) || os(tvOS) || (swift(>=5.9) && os(visionOS))) && !SENTRY_NO_UIKIT
44
import UIKit
55
typealias Application = UIApplication
6-
#elseif (os(macOS) || targetEnvironment(macCatalyst)) && !SENTRY_NO_UIKIT
6+
#elseif os(macOS)
77
import AppKit
88
typealias Application = NSApplication
99
#endif
@@ -50,7 +50,7 @@ typealias Application = NSApplication
5050
// WillTerminate is called no matter if started from the background or launched into the
5151
// foreground.
5252

53-
#if ((os(iOS) || os(tvOS) || (swift(>=5.9) && os(visionOS))) && !SENTRY_NO_UIKIT) || ((os(macOS) || targetEnvironment(macCatalyst)) && !SENTRY_NO_UIKIT)
53+
#if ((os(iOS) || os(tvOS) || (swift(>=5.9) && os(visionOS))) && !SENTRY_NO_UIKIT) || os(macOS)
5454

5555
// Call before subscribing to the notifications to avoid that didBecomeActive gets called before
5656
// ending the cached session.
@@ -84,7 +84,7 @@ typealias Application = NSApplication
8484
}
8585

8686
@objc public func removeObservers() {
87-
#if ((os(iOS) || os(tvOS) || (swift(>=5.9) && os(visionOS))) && !SENTRY_NO_UIKIT) || ((os(macOS) || targetEnvironment(macCatalyst)) && !SENTRY_NO_UIKIT)
87+
#if ((os(iOS) || os(tvOS) || (swift(>=5.9) && os(visionOS))) && !SENTRY_NO_UIKIT) || os(macOS)
8888
// Remove the observers with the most specific detail possible, see
8989
// https://developer.apple.com/documentation/foundation/nsnotificationcenter/1413994-removeobserver
9090
notificationCenter.removeObserver(self, name: Application.didBecomeActiveNotification, object: nil)

Sources/Swift/SentryDependencyContainer.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -257,6 +257,6 @@ extension SentryFileManager: SentryFileManagerProtocol { }
257257
extension SentryDependencyContainer: ScreenshotSourceProvider { }
258258
#endif
259259

260-
#if ((os(iOS) || os(tvOS) || (swift(>=5.9) && os(visionOS))) && !SENTRY_NO_UIKIT) || ((os(macOS) || targetEnvironment(macCatalyst)) && !SENTRY_NO_UIKIT)
260+
#if ((os(iOS) || os(tvOS) || (swift(>=5.9) && os(visionOS))) && !SENTRY_NO_UIKIT) || os(macOS)
261261
extension SentryDependencyContainer: NotificationCenterProvider { }
262262
#endif

0 commit comments

Comments
 (0)