diff --git a/Sources/Sentry/SentryPerformanceTracker.m b/Sources/Sentry/SentryPerformanceTracker.m index cf1a3e98c0..322e23d9ce 100644 --- a/Sources/Sentry/SentryPerformanceTracker.m +++ b/Sources/Sentry/SentryPerformanceTracker.m @@ -61,36 +61,36 @@ - (SentrySpanId *)startSpanWithName:(NSString *)name operation:operation origin:origin]; - [SentrySDK.currentHub.scope useSpan:^(id span) { - BOOL bindToScope = NO; - if (span == nil) { - bindToScope = YES; - } + id span = SentrySDK.currentHub.scope.span; + + BOOL bindToScope = NO; + if (span == nil) { + bindToScope = YES; + } #if SENTRY_HAS_UIKIT - else { - if ([SentryUIEventTracker isUIEventOperation:span.operation]) { - SENTRY_LOG_DEBUG( - @"Cancelling previous UI event span %@", span.spanId.sentrySpanIdString); - [span finishWithStatus:kSentrySpanStatusCancelled]; - bindToScope = YES; - } + else { + if ([SentryUIEventTracker isUIEventOperation:span.operation]) { + SENTRY_LOG_DEBUG( + @"Cancelling previous UI event span %@", span.spanId.sentrySpanIdString); + [span finishWithStatus:kSentrySpanStatusCancelled]; + bindToScope = YES; } + } #endif // SENTRY_HAS_UIKIT - SENTRY_LOG_DEBUG(@"Creating new transaction bound to scope: %d", bindToScope); + SENTRY_LOG_DEBUG(@"Creating new transaction bound to scope: %d", bindToScope); - newSpan = [SentrySDK.currentHub - startTransactionWithContext:context - bindToScope:bindToScope - customSamplingContext:@{} - configuration:[SentryTracerConfiguration configurationWithBlock:^( - SentryTracerConfiguration *configuration) { - configuration.waitForChildren = YES; - configuration.finishMustBeCalled = YES; - }]]; + newSpan = [SentrySDK.currentHub + startTransactionWithContext:context + bindToScope:bindToScope + customSamplingContext:@{} + configuration:[SentryTracerConfiguration configurationWithBlock:^( + SentryTracerConfiguration *configuration) { + configuration.waitForChildren = YES; + configuration.finishMustBeCalled = YES; + }]]; - [(SentryTracer *)newSpan setDelegate:self]; - }]; + [(SentryTracer *)newSpan setDelegate:self]; } SentrySpanId *spanId = newSpan.spanId;