Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions Crashlytics/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
- [fixed] Fixed a deadlock in Firebase Sessions where the main thread could
block waiting for a lock held by a background thread during settings
updates. (#15394)
- [fixed] Fixed an issue where Crashlytics API calls were silently dropped if invoked immediately after Firebase initialization.

# 12.9.0
- [fixed] Conformed to Mach IPC security restrictions. (#15393)
Expand Down
2 changes: 2 additions & 0 deletions Crashlytics/Crashlytics/Components/FIRCLSUserLogging.m
Original file line number Diff line number Diff line change
Expand Up @@ -241,6 +241,8 @@ void FIRCLSUserLoggingRecordKeysAndValues(NSDictionary *keysAndValues,
FIRCLSUserLoggingKVStorage *storage,
uint32_t *counter) {
if (!FIRCLSContextIsInitialized()) {
FIRCLSSDKLogWarn(
"Failed to write key/value pair. Crashlytics context has not initialized yet.\n");
return;
}

Expand Down
22 changes: 17 additions & 5 deletions Crashlytics/Crashlytics/FIRCrashlytics.m
Original file line number Diff line number Diff line change
Expand Up @@ -311,7 +311,10 @@ - (void)processDidCrashDuringPreviousExecution {

#pragma mark - API: Logging
- (void)log:(NSString *)msg {
FIRCLSLog(@"%@", msg);
[self waitForContextInit:@"log"
callback:^{
FIRCLSLog(@"%@", msg);
}];
}

- (void)logWithFormat:(NSString *)format, ... {
Expand Down Expand Up @@ -354,17 +357,26 @@ - (void)deleteUnsentReports {

#pragma mark - API: setUserID
- (void)setUserID:(nullable NSString *)userID {
FIRCLSUserLoggingRecordInternalKeyValue(FIRCLSUserIdentifierKey, userID);
[self waitForContextInit:@"setUserID"
callback:^{
FIRCLSUserLoggingRecordInternalKeyValue(FIRCLSUserIdentifierKey, userID);
}];
}

#pragma mark - API: setCustomValue

- (void)setCustomValue:(nullable id)value forKey:(NSString *)key {
FIRCLSUserLoggingRecordUserKeyValue(key, value);
[self waitForContextInit:@"setCustomValue"
callback:^{
FIRCLSUserLoggingRecordUserKeyValue(key, value);
}];
}

- (void)setCustomKeysAndValues:(NSDictionary *)keysAndValues {
FIRCLSUserLoggingRecordUserKeysAndValues(keysAndValues);
[self waitForContextInit:@"setCustomKeysAndValues"
callback:^{
FIRCLSUserLoggingRecordUserKeysAndValues(keysAndValues);
}];
}

#pragma mark - API: Development Platform
Expand Down Expand Up @@ -456,7 +468,7 @@ - (void)rolloutsStateDidChange:(FIRRolloutsState *_Nonnull)rolloutsState {
reportID:currentReportID];
}

#pragma mark - Private Helpsers
#pragma mark - Private Helpers
- (void)waitForContextInit:(NSString *)contextLog callback:(void (^)(void))callback {
if (!_contextInitPromise) {
FIRCLSErrorLog(@"Crashlytics method called before SDK was initialized: %@", contextLog);
Expand Down
Loading