Skip to content

Commit b13e93a

Browse files
authored
Fix flaky test (#5490)
1 parent e64d3d4 commit b13e93a

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

Samples/SentrySampleShared/SentrySampleShared/UIViewControllerExtension.swift

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,12 @@ import UIKit
66

77
public extension UIViewController {
88
func createTransactionObserver(forCallback: @escaping (Span) -> Void) -> SpanObserver? {
9-
let result = SpanObserver(callback: forCallback)
9+
let result = SpanObserver { span in
10+
// This callback may not be on the main queue, but `forCallback` is always called on the main queue.
11+
DispatchQueue.main.async {
12+
forCallback(span)
13+
}
14+
}
1015
if result == nil {
1116
UIAssert.fail("Transaction was not created")
1217
}

0 commit comments

Comments
 (0)