3636
3737#import " RNSentryEvents.h"
3838#import " RNSentryDependencyContainer.h"
39- #import " RNSentryFramesTrackerListener.h"
39+
40+ #if SENTRY_HAS_UIKIT
4041#import " RNSentryRNSScreen.h"
42+ #import " RNSentryFramesTrackerListener.h"
43+ #endif
4144
4245@interface SentryTraceContext : NSObject
4346- (nullable instancetype )initWithDict : (NSDictionary <NSString *, id> *)dictionary ;
@@ -192,6 +195,7 @@ - (void)setEventEnvironmentTag:(SentryEvent *)event
192195RCT_EXPORT_METHOD (initNativeReactNavigationNewFrameTracking:(RCTPromiseResolveBlock)resolve
193196 rejecter:(RCTPromiseRejectBlock)reject)
194197{
198+ #if SENTRY_HAS_UIKIT
195199 if ([[NSThread currentThread ] isMainThread ]) {
196200 [RNSentryRNSScreen swizzleViewDidAppear ];
197201 } else {
@@ -201,16 +205,20 @@ - (void)setEventEnvironmentTag:(SentryEvent *)event
201205 }
202206
203207 [self initFramesTracking ];
208+ #endif
204209 resolve (nil );
205210}
206211
207212- (void )initFramesTracking {
213+ #if SENTRY_HAS_UIKIT
214+
208215 RNSentryEmitNewFrameEvent emitNewFrameEvent = ^(NSNumber *newFrameTimestampInSeconds) {
209216 if (self->hasListeners ) {
210217 [self sendEventWithName: RNSentryNewFrameEvent body: @{ @" newFrameTimestampInSeconds" : newFrameTimestampInSeconds }];
211218 }
212219 };
213220 [[RNSentryDependencyContainer sharedInstance ] initializeFramesTrackerListenerWith: emitNewFrameEvent];
221+ #endif
214222}
215223
216224// Will be called when this module's first listener is added.
@@ -370,7 +378,7 @@ - (NSDictionary*) fetchNativeStackFramesBy: (NSArray<NSNumber*>*)instructionsAdd
370378RCT_EXPORT_METHOD (fetchNativeAppStart:(RCTPromiseResolveBlock)resolve
371379 rejecter:(RCTPromiseRejectBlock)reject)
372380{
373-
381+ # if SENTRY_HAS_UIKIT
374382 SentryAppStartMeasurement *appStartMeasurement = PrivateSentrySDKOnly.appStartMeasurement ;
375383
376384 if (appStartMeasurement == nil ) {
@@ -389,6 +397,9 @@ - (NSDictionary*) fetchNativeStackFramesBy: (NSArray<NSNumber*>*)instructionsAdd
389397 // This is always set to true, as we would only allow an app start fetch to only happen once
390398 // in the case of a JS bundle reload, we do not want it to be instrumented again.
391399 didFetchAppStart = true ;
400+ #else
401+ resolve (nil );
402+ #endif
392403}
393404
394405RCT_EXPORT_METHOD (fetchNativeFrames:(RCTPromiseResolveBlock)resolve
0 commit comments