Skip to content

Instantly share code, notes, and snippets.

@pixelknitter
Last active October 11, 2015 17:38
Show Gist options
  • Save pixelknitter/3895598 to your computer and use it in GitHub Desktop.
Save pixelknitter/3895598 to your computer and use it in GitHub Desktop.
Code Snippets for Crittercism iOS Docs
[Crittercism leaveBreadcrumb:@"<breadcrumb>"];
// Declare the Crittercism Delegate
@interface MyAwesomeViewController : UIViewController <CrittercismDelegate>
// Implement the protocol
#pragma mark CrittercismDelegate
-(void)crittercismDidCrashOnLastLoad {
NSLog(@"App crashed the last time it was loaded");
}
// Add your delegate to the Crittercism shared object
[[Crittercism sharedInstance] setDelegate: <view controller where you implemented the protocol>]
@try {
[NSException raise:NSInvalidArgumentException
format:@"Foo must not be nil"];
} @catch (NSException *exception) {
// Pass it on to us!
[Crittercism logHandledException:exception];
}
// Or send us something fully custom
NSException *exception = [NSException exceptionWithName:@"My Custom Exception" reason:@"I have a great reason" userInfo:nil];
[Crittercism logHandledException:exception];
[Crittercism setValue:(NSString *)value forKey:(NSString *)key];
[Crittercism setAge:(int)age];
[Crittercism setEmail:(NSString *)email];
[Crittercism setGender:(NSString *)gender];
// Opt the user out
[Crittercism setOptOutStatus: YES];
[Crittercism setUsername:(NSString *)username];
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment