@@ -111,6 +111,8 @@ @interface FIRCrashlytics () <FIRLibrary,
111
111
// Dependencies common to each of the Controllers
112
112
@property (nonatomic , strong ) FIRCLSManagerData *managerData;
113
113
114
+ @property (nonatomic , nullable ) FBLPromise *contextInitPromise;
115
+
114
116
@end
115
117
116
118
@implementation FIRCrashlytics
@@ -197,14 +199,15 @@ - (instancetype)initWithApp:(FIRApp *)app
197
199
});
198
200
}
199
201
200
- [[[_reportManager startWithProfiling ] then: ^id _Nullable (NSNumber *_Nullable value) {
201
- if (![value boolValue ]) {
202
- FIRCLSErrorLog (@" Crash reporting could not be initialized" );
203
- }
204
- return value;
205
- }] catch: ^void (NSError *error) {
206
- FIRCLSErrorLog (@" Crash reporting failed to initialize with error: %@ " , error);
207
- }];
202
+ _contextInitPromise =
203
+ [[[_reportManager startWithProfiling ] then: ^id _Nullable (NSNumber *_Nullable value) {
204
+ if (![value boolValue ]) {
205
+ FIRCLSErrorLog (@" Crash reporting could not be initialized" );
206
+ }
207
+ return value;
208
+ }] catch: ^void (NSError *error) {
209
+ FIRCLSErrorLog (@" Crash reporting failed to initialize with error: %@ " , error);
210
+ }];
208
211
209
212
// RemoteConfig subscription should be made after session report directory created.
210
213
if (remoteConfig) {
@@ -307,7 +310,10 @@ - (void)processDidCrashDuringPreviousExecution {
307
310
308
311
#pragma mark - API: Logging
309
312
- (void )log : (NSString *)msg {
310
- FIRCLSLog (@" %@ " , msg);
313
+ [_contextInitPromise then: ^id _Nullable (id _Nullable value) {
314
+ FIRCLSLog (@" %@ " , msg);
315
+ return nil ;
316
+ }];
311
317
}
312
318
313
319
- (void )logWithFormat : (NSString *)format , ... {
@@ -350,17 +356,26 @@ - (void)deleteUnsentReports {
350
356
351
357
#pragma mark - API: setUserID
352
358
- (void )setUserID : (nullable NSString *)userID {
353
- FIRCLSUserLoggingRecordInternalKeyValue (FIRCLSUserIdentifierKey, userID);
359
+ [_contextInitPromise then: ^id _Nullable (id _Nullable value) {
360
+ FIRCLSUserLoggingRecordInternalKeyValue (FIRCLSUserIdentifierKey, userID);
361
+ return nil ;
362
+ }];
354
363
}
355
364
356
365
#pragma mark - API: setCustomValue
357
366
358
367
- (void )setCustomValue : (nullable id )value forKey : (NSString *)key {
359
- FIRCLSUserLoggingRecordUserKeyValue (key, value);
368
+ [_contextInitPromise then: ^id _Nullable (id _Nullable value) {
369
+ FIRCLSUserLoggingRecordUserKeyValue (key, value);
370
+ return nil ;
371
+ }];
360
372
}
361
373
362
374
- (void )setCustomKeysAndValues : (NSDictionary *)keysAndValues {
363
- FIRCLSUserLoggingRecordUserKeysAndValues (keysAndValues);
375
+ [_contextInitPromise then: ^id _Nullable (id _Nullable value) {
376
+ FIRCLSUserLoggingRecordUserKeysAndValues (keysAndValues);
377
+ return nil ;
378
+ }];
364
379
}
365
380
366
381
#pragma mark - API: Development Platform
@@ -383,8 +398,11 @@ - (NSString *)developmentPlatformName {
383
398
}
384
399
385
400
- (void )setDevelopmentPlatformName : (NSString *)developmentPlatformName {
386
- FIRCLSUserLoggingRecordInternalKeyValue (FIRCLSDevelopmentPlatformNameKey,
387
- developmentPlatformName);
401
+ [_contextInitPromise then: ^id _Nullable (id _Nullable value) {
402
+ FIRCLSUserLoggingRecordInternalKeyValue (FIRCLSDevelopmentPlatformNameKey,
403
+ developmentPlatformName);
404
+ return nil ;
405
+ }];
388
406
}
389
407
390
408
- (NSString *)developmentPlatformVersion {
@@ -393,8 +411,11 @@ - (NSString *)developmentPlatformVersion {
393
411
}
394
412
395
413
- (void )setDevelopmentPlatformVersion : (NSString *)developmentPlatformVersion {
396
- FIRCLSUserLoggingRecordInternalKeyValue (FIRCLSDevelopmentPlatformVersionKey,
397
- developmentPlatformVersion);
414
+ [_contextInitPromise then: ^id _Nullable (id _Nullable value) {
415
+ FIRCLSUserLoggingRecordInternalKeyValue (FIRCLSDevelopmentPlatformVersionKey,
416
+ developmentPlatformVersion);
417
+ return nil ;
418
+ }];
398
419
}
399
420
400
421
#pragma mark - API: Errors and Exceptions
0 commit comments