@@ -21,7 +21,9 @@ - (instancetype)initWithTraceId:(SentryId *)traceId
2121 releaseName : (nullable NSString *)releaseName
2222 environment : (nullable NSString *)environment
2323 transaction : (nullable NSString *)transaction
24+ #if !SDK_V9
2425 userSegment:(nullable NSString *)userSegment
26+ #endif
2527 sampleRate:(nullable NSString *)sampleRate
2628 sampled:(nullable NSString *)sampled
2729 replayId:(nullable NSString *)replayId
@@ -31,7 +33,9 @@ - (instancetype)initWithTraceId:(SentryId *)traceId
3133 releaseName: releaseName
3234 environment: environment
3335 transaction: transaction
36+ #if !SDK_V9
3437 userSegment:userSegment
38+ #endif
3539 sampleRate: sampleRate
3640 sampleRand: nil
3741 sampled: sampled
@@ -43,7 +47,9 @@ - (instancetype)initWithTraceId:(SentryId *)traceId
4347 releaseName : (nullable NSString *)releaseName
4448 environment : (nullable NSString *)environment
4549 transaction : (nullable NSString *)transaction
50+ #if !SDK_V9
4651 userSegment:(nullable NSString *)userSegment
52+ #endif
4753 sampleRate:(nullable NSString *)sampleRate
4854 sampleRand:(nullable NSString *)sampleRand
4955 sampled:(nullable NSString *)sampled
@@ -55,7 +61,9 @@ - (instancetype)initWithTraceId:(SentryId *)traceId
5561 _environment = environment;
5662 _releaseName = releaseName;
5763 _transaction = transaction;
64+ #if !SDK_V9
5865 _userSegment = userSegment;
66+ #endif
5967 _sampleRand = sampleRand;
6068 _sampleRate = sampleRate;
6169 _sampled = sampled;
@@ -81,14 +89,15 @@ - (nullable instancetype)initWithTracer:(SentryTracer *)tracer
8189 if (tracer.traceId == nil || options.parsedDsn == nil )
8290 return nil ;
8391
84- NSString *userSegment;
85-
86- #pragma clang diagnostic push
87- #pragma clang diagnostic ignored "-Wdeprecated-declarations"
92+ # if !SDK_V9
93+ NSString *userSegment = nil ;
94+ # pragma clang diagnostic push
95+ # pragma clang diagnostic ignored "-Wdeprecated-declarations"
8896 if (scope.userObject .segment ) {
8997 userSegment = scope.userObject .segment ;
9098 }
91- #pragma clang diagnostic pop
99+ # pragma clang diagnostic pop
100+ #endif // !SDK_V9
92101
93102 NSString *serializedSampleRand = nil ;
94103 NSNumber *sampleRand = [tracer.transactionContext sampleRand ];
@@ -112,7 +121,9 @@ - (nullable instancetype)initWithTracer:(SentryTracer *)tracer
112121 releaseName: options.releaseName
113122 environment: options.environment
114123 transaction: tracer.transactionContext.name
124+ #if !SDK_V9
115125 userSegment:userSegment
126+ #endif
116127 sampleRate: serializedSampleRate
117128 sampleRand: serializedSampleRand
118129 sampled: sampled
@@ -121,15 +132,19 @@ - (nullable instancetype)initWithTracer:(SentryTracer *)tracer
121132
122133- (instancetype )initWithTraceId : (SentryId *)traceId
123134 options : (SentryOptions *)options
135+ #if !SDK_V9
124136 userSegment:(nullable NSString *)userSegment
137+ #endif
125138 replayId:(nullable NSString *)replayId;
126139{
127140 return [[SentryTraceContext alloc ] initWithTraceId: traceId
128141 publicKey: options.parsedDsn.url.user
129142 releaseName: options.releaseName
130143 environment: options.environment
131144 transaction: nil
145+ #if !SDK_V9
132146 userSegment:userSegment
147+ #endif
133148 sampleRate: nil
134149 sampleRand: nil
135150 sampled: nil
@@ -143,6 +158,7 @@ - (nullable instancetype)initWithDict:(NSDictionary<NSString *, id> *)dictionary
143158 if (traceId == nil || publicKey == nil )
144159 return nil ;
145160
161+ #if !SDK_V9
146162 NSString *userSegment;
147163 if (dictionary[@" user" ] != nil ) {
148164 NSDictionary *userInfo = dictionary[@" user" ];
@@ -151,13 +167,16 @@ - (nullable instancetype)initWithDict:(NSDictionary<NSString *, id> *)dictionary
151167 } else {
152168 userSegment = dictionary[@" user_segment" ];
153169 }
170+ #endif
154171
155172 return [self initWithTraceId: traceId
156173 publicKey: publicKey
157174 releaseName: dictionary[@" release" ]
158175 environment: dictionary[@" environment" ]
159176 transaction: dictionary[@" transaction" ]
177+ #if !SDK_V9
160178 userSegment:userSegment
179+ #endif
161180 sampleRate: dictionary[@" sample_rate" ]
162181 sampleRand: dictionary[@" sample_rand" ]
163182 sampled: dictionary[@" sampled" ]
@@ -171,7 +190,9 @@ - (SentryBaggage *)toBaggage
171190 releaseName: _releaseName
172191 environment: _environment
173192 transaction: _transaction
193+ #if !SDK_V9
174194 userSegment:_userSegment
195+ #endif
175196 sampleRate: _sampleRate
176197 sampleRand: _sampleRand
177198 sampled: _sampled
@@ -196,9 +217,11 @@ - (SentryBaggage *)toBaggage
196217 [result setValue: _transaction forKey: @" transaction" ];
197218 }
198219
220+ #if !SDK_V9
199221 if (_userSegment != nil ) {
200222 [result setValue: _userSegment forKey: @" user_segment" ];
201223 }
224+ #endif
202225
203226 if (_sampleRand != nil ) {
204227 [result setValue: _sampleRand forKey: @" sample_rand" ];
0 commit comments