Add generateTestCrash method

This commit is contained in:
Andreas Linde 2013-11-21 00:03:14 +01:00
parent 5c5a549c75
commit 720dbccefe
2 changed files with 28 additions and 0 deletions

View File

@ -227,4 +227,20 @@ typedef NS_ENUM(NSUInteger, BITCrashManagerStatus) {
*/
- (BOOL)isDebuggerAttached;
/**
* Lets the app crash for easy testing of the SDK
*
* The best way to use this is to trigger the crash with a button action.
*
* Make sure not to let the app crash in `applicationDidFinishLaunching` or any other
* startup method! Since otherwise the app would crash before the SDK could process it.
*
* Note that our SDK provides support for handling crashes that happen early on startup.
* Check the documentation for more information on how to use this.
*
* If the SDK detects an App Store environment, it will _NOT_ cause the app to crash!
*/
- (void)generateTestCrash;
@end

View File

@ -419,6 +419,18 @@ NSString *const kBITCrashManagerStatus = @"BITCrashManagerStatus";
}
- (void)generateTestCrash {
if (![self isAppStoreEnvironment]) {
if ([self isDebuggerAttached]) {
NSLog(@"[HockeySDK] WARNING: The debugger is attached. The following crash cannot be detected by the SDK!");
}
__builtin_trap();
}
}
#pragma mark - PLCrashReporter
/**