@@ -171,7 +171,7 @@ - (NSDictionary *)staticContext {
171
171
return dict;
172
172
}
173
173
174
- - (NSMutableDictionary *)liveContext {
174
+ - (NSDictionary *)liveContext {
175
175
NSMutableDictionary *context = [[NSMutableDictionary alloc ] init ];
176
176
177
177
[context addEntriesFromDictionary: self .context];
@@ -209,7 +209,7 @@ - (NSMutableDictionary *)liveContext {
209
209
traits;
210
210
});
211
211
212
- return context;
212
+ return [ context copy ] ;
213
213
}
214
214
215
215
- (void )dispatchBackground : (void (^)(void ))block {
@@ -343,7 +343,7 @@ - (void)enqueueAction:(NSString *)action dictionary:(NSDictionary *)dictionary o
343
343
payload[@" type" ] = action;
344
344
payload[@" timestamp" ] = [[NSDate date ] description ];
345
345
payload[@" messageId" ] = GenerateUUIDString ();
346
-
346
+
347
347
[self dispatchBackground: ^{
348
348
// attach userId and anonymousId inside the dispatch_async in case
349
349
// they've changed (see identify function)
@@ -354,9 +354,10 @@ - (void)enqueueAction:(NSString *)action dictionary:(NSDictionary *)dictionary o
354
354
355
355
NSDictionary *defaultContext = [self liveContext ];
356
356
NSDictionary *customContext = options[@" context" ];
357
- int capacity = customContext.count + defaultContext.count ;
357
+
358
+ NSUInteger capacity = customContext.count + defaultContext.count ;
358
359
NSMutableDictionary *context = [NSMutableDictionary dictionaryWithCapacity: capacity];
359
- [context setValue: _traits forKey: @" traits " ];
360
+
360
361
[context addEntriesFromDictionary: defaultContext];
361
362
[context addEntriesFromDictionary: customContext]; // let the custom context override ours
362
363
[payload setValue: context forKey: @" context" ];
0 commit comments