At times, even full stack traces with line numbers aren't quite enough to pinpoint the bug. To give you even more insight, Crashlytics provides 3 logging mechanisms right out of the box, Custom Logging, Custom Keys, and User Information.
Context is king when debugging crashes, and knowing the values of critical variables in your app, such as the level of the game the user got to, how many friends they have, or the byte size of the last photo they took, might be critical in shaving hours off your debugging time.
You're in luck - Crashlytics allows you to associate arbitrary key/value pairs with your crash reports, and they're viewable right from the Crashlytics dashboard. Setting keys is as easy as calling:
or one of the related methods.
+ (void)setObjectValue:(id)value forKey:(NSString *)key; // calls -description on value, perfect for NSStrings!
+ (void)setIntValue:(int)value forKey:(NSString *)key;
+ (void)setBoolValue:(BOOL)value forKey:(NSString *)key;
+ (void)setFloatValue:(float)value forKey:(NSString *)key;
Re-setting the same key will update the value.
[Crashlytics setIntValue:3 forKey:@"current_level"];
[Crashlytics setObjectValue:@"logged_in" forKey:@"last_UI_action"];
Note: By default, Crashlytics currently supports a maximum of 64 key/value pairs. Once you reach this threshold, additional values are not saved. If you need more, please contact support.
Thread safe as of SDK version 1.1.6.