Created
September 29, 2012 01:28
-
-
Save hhyyy9/3802852 to your computer and use it in GitHub Desktop.
当程序崩溃(Crash)时发出通知
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1 | |
2 | |
3 | |
4 | |
5 | |
6 | |
7 | |
8 | |
9 | |
10 | |
11 | |
12 | |
13 | |
14 | |
15 | |
16 | |
17 | |
//BSCrashNotifier is a bundle that allows you to be notified when your app is crashing. | |
NSBundle* bundle = [NSBundle bundleWithPath:[[NSBundle mainBundle] pathForResource:@"BSCrashNotifier" ofType:@"bundle"]]; | |
Class crashNotifierClass = [bundle principalClass]; | |
if (crashNotifierClass) | |
{ | |
[crashNotifierClass onCrashSend:@selector(weCrashed:) to:self]; | |
} | |
else | |
{ | |
NSLog(@"couldn't load bundle"); | |
} | |
//and implement the notification method like: | |
- (void)weCrashed:(int)signalNumber | |
{ | |
NSLog(@"we crashed: %i",signalNumber); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment