2

I have an error that is preventing some users from authenticating via OAuth. The authentication framework is returning an NSError in some cases that does not cause a hard crash - but I'd like to log it in some way to Crashlytics. Is this possible? I tried logging with:

NSDictionary *attributes = @{ ... };
[Crashlytics logEvent:@"authenticate.error" attributes:attributes];

But I can't seem to find where that event appears within the internal reporting tool.

Edit: I've found an equivalent to what I'm trying to do for Android (but am unsure how to do something similar in iOS) here: http://support.crashlytics.com/knowledgebase/articles/202805-logging-caught-exceptions

Kevin Sylvestre
  • 37,288
  • 33
  • 152
  • 232

1 Answers1

1

Use the CLSNSLog() function, which acts just like NSLog():

#import <Crashlytics/Crashlytics.h>
...
CLSNSLog(@"Authentication error: %@", [error localizedDescription]);

However the data is only sent with a crash log, so you would be forced to crash, which is not ideal.

trojanfoe
  • 120,358
  • 21
  • 212
  • 242
  • Thanks - I noticed some of those logging methods but was hoping to find a way to log without crashing the app. – Kevin Sylvestre Nov 04 '15 at 19:56
  • @KevinSylvestre I don't believe it's possible as the only *deliverable* (so to speak) is a crash log. The log messages are used to embellish the logs so you can see what was happening in your app prior to the crash. I think it only delivers the last 50 or 100 of them with the crash log. – trojanfoe Nov 04 '15 at 20:06