diff --git a/Samples/iOS-Swift/iOS-Swift-UITests/LaunchUITests.swift b/Samples/iOS-Swift/iOS-Swift-UITests/LaunchUITests.swift index 4091f8c584e..58285bb46b1 100644 --- a/Samples/iOS-Swift/iOS-Swift-UITests/LaunchUITests.swift +++ b/Samples/iOS-Swift/iOS-Swift-UITests/LaunchUITests.swift @@ -92,6 +92,20 @@ class LaunchUITests: BaseUITest { XCTAssertTrue(0.5 > frozenFramesPercentage, "Too many frozen frames.") } + func testCorruptEnvelope() { + // This is to prevent https://github.com/getsentry/sentry-cocoa/issues/4280 + // Tapping "Corrupt Envelope" will try to capture an envelope but it closes the app + // in the middle of the process. For 8.33.0 this would generate a corrupted envelope. + // 8.35.0+ reverts to writing envelopes atomically, so that in this scenario no envelope is written, as is expected. + // By opening the app again we can check whether the SDK can handle such scenario. + app.buttons["Corrupt Envelope"].tap() + XCTAssertEqual(app.state, .notRunning) + + app.launch() + XCTAssertEqual(app.state, .runningForeground) + app.tabBars.firstMatch.waitForExistence("App did not open again") + } + func testCheckTotalFrames() { app.buttons["Extra"].tap() diff --git a/Samples/iOS-Swift/iOS-Swift.xcodeproj/project.pbxproj b/Samples/iOS-Swift/iOS-Swift.xcodeproj/project.pbxproj index aa60769d555..9c55e518915 100644 --- a/Samples/iOS-Swift/iOS-Swift.xcodeproj/project.pbxproj +++ b/Samples/iOS-Swift/iOS-Swift.xcodeproj/project.pbxproj @@ -329,6 +329,7 @@ D8269A42274C095F00BD5BD5 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; D8269A49274C096000BD5BD5 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; D8269A5C274C108100BD5BD5 /* iOS13-Swift.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = "iOS13-Swift.entitlements"; sourceTree = ""; }; + D82915932C889F1800A6CDD4 /* SentryCocoaPrivate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SentryCocoaPrivate.h; sourceTree = ""; }; D83A30DF279F1F5C00372D0A /* fatal-error-binary-images-message2.json */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.json; name = "fatal-error-binary-images-message2.json"; path = "../../../Tests/Resources/fatal-error-binary-images-message2.json"; sourceTree = ""; }; D840D520273A07F400CDF142 /* iOS-SwiftClip.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = "iOS-SwiftClip.app"; sourceTree = BUILT_PRODUCTS_DIR; }; D840D522273A07F400CDF142 /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; }; @@ -611,6 +612,7 @@ D8F01DF02A1377D0008F4996 /* SentryExposure.h */, D8832B192AF4FE2000C522B0 /* SentryUIApplication.h */, 629EC8AC2B0B537400858855 /* TriggerAppHang.swift */, + D82915932C889F1800A6CDD4 /* SentryCocoaPrivate.h */, ); path = Tools; sourceTree = ""; diff --git a/Samples/iOS-Swift/iOS-Swift/Base.lproj/Main.storyboard b/Samples/iOS-Swift/iOS-Swift/Base.lproj/Main.storyboard index c3745fcac53..97001ac0a30 100644 --- a/Samples/iOS-Swift/iOS-Swift/Base.lproj/Main.storyboard +++ b/Samples/iOS-Swift/iOS-Swift/Base.lproj/Main.storyboard @@ -711,13 +711,13 @@ - + - + - + + - +