資源簡介
通過【NSSetUncaughtExceptionHandler】機制捕獲處理app的異常

代碼片段和文件信息
//
//??AppDelegate.m
//??DemoExceptionHandler
//
//??Created?by?chenzm?on?2018/9/7.
//??Copyright???2018年?chenzm.?All?rights?reserved.
//
#import?“AppDelegate.h“
#import?“UncaughtExceptionHandler.h“
@interface?AppDelegate?()
@end
@implementation?AppDelegate
-?(BOOL)application:(UIApplication?*)application?didFinishLaunchingWithOptions:(NSDictionary?*)launchOptions?{
????
????[UncaughtExceptionHandler?installUncaughtExceptionHandler:YES?showAlert:YES];
????
????return?YES;
}
-?(void)applicationWillResignActive:(UIApplication?*)application?{
????//?Sent?when?the?application?is?about?to?move?from?active?to?inactive?state.?This?can?occur?for?certain?types?of?temporary?interruptions?(such?as?an?incoming?phone?call?or?SMS?message)?or?when?the?user?quits?the?application?and?it?begins?the?transition?to?the?background?state.
????//?Use?this?method?to?pause?ongoing?tasks?disable?timers?and?invalidate?graphics?rendering?callbacks.?Games?should?use?this?method?to?pause?the?game.
}
-?(void)applicationDidEnterBackground:(UIApplication?*)application?{
????//?Use?this?method?to?release?shared?resources?save?user?data?invalidate?timers?and?store?enough?application?state?information?to?restore?your?application?to?its?current?state?in?case?it?is?terminated?later.
????//?If?your?application?supports?background?execution?this?method?is?called?instead?of?applicationWillTerminate:?when?the?user?quits.
}
-?(void)applicationWillEnterForeground:(UIApplication?*)application?{
????//?Called?as?part?of?the?transition?from?the?background?to?the?active?state;?here?you?can?undo?many?of?the?changes?made?on?entering?the?background.
}
-?(void)applicationDidBecomeActive:(UIApplication?*)application?{
????//?Restart?any?tasks?that?were?paused?(or?not?yet?started)?while?the?application?was?inactive.?If?the?application?was?previously?in?the?background?optionally?refresh?the?user?interface.
}
-?(void)applicationWillTerminate:(UIApplication?*)application?{
????//?Called?when?the?application?is?about?to?terminate.?Save?data?if?appropriate.?See?also?applicationDidEnterBackground:.
}
@end
?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----
?????目錄???????????0??2018-09-07?14:45??DemoExceptionHandler\
?????目錄???????????0??2018-09-07?13:04??DemoExceptionHandler\DemoExceptionHandler\
?????文件?????????285??2018-09-07?11:12??DemoExceptionHandler\DemoExceptionHandler\AppDelegate.h
?????目錄???????????0??2018-09-07?15:14??__MACOSX\
?????目錄???????????0??2018-09-07?15:14??__MACOSX\DemoExceptionHandler\
?????目錄???????????0??2018-09-07?15:14??__MACOSX\DemoExceptionHandler\DemoExceptionHandler\
?????文件?????????227??2018-09-07?11:12??__MACOSX\DemoExceptionHandler\DemoExceptionHandler\._AppDelegate.h
?????目錄???????????0??2018-09-07?11:12??DemoExceptionHandler\DemoExceptionHandler\Assets.xcassets\
?????目錄???????????0??2018-09-07?11:12??DemoExceptionHandler\DemoExceptionHandler\Assets.xcassets\AppIcon.appiconset\
?????文件????????1495??2018-09-07?11:12??DemoExceptionHandler\DemoExceptionHandler\Assets.xcassets\AppIcon.appiconset\Contents.json
?????目錄???????????0??2018-09-07?15:14??__MACOSX\DemoExceptionHandler\DemoExceptionHandler\Assets.xcassets\
?????目錄???????????0??2018-09-07?15:14??__MACOSX\DemoExceptionHandler\DemoExceptionHandler\Assets.xcassets\AppIcon.appiconset\
?????文件?????????171??2018-09-07?11:12??__MACOSX\DemoExceptionHandler\DemoExceptionHandler\Assets.xcassets\AppIcon.appiconset\._Contents.json
?????文件????????1194??2018-09-07?13:04??DemoExceptionHandler\DemoExceptionHandler\ViewController.m
?????文件?????????176??2018-09-07?13:04??__MACOSX\DemoExceptionHandler\DemoExceptionHandler\._ViewController.m
?????目錄???????????0??2018-09-07?11:50??DemoExceptionHandler\DemoExceptionHandler\ba
?????文件????????1564??2018-09-07?11:50??DemoExceptionHandler\DemoExceptionHandler\ba
?????目錄???????????0??2018-09-07?15:14??__MACOSX\DemoExceptionHandler\DemoExceptionHandler\ba
?????文件?????????176??2018-09-07?11:50??__MACOSX\DemoExceptionHandler\DemoExceptionHandler\ba
?????文件????????1565??2018-09-07?11:49??DemoExceptionHandler\DemoExceptionHandler\ba
?????文件?????????333??2018-09-07?11:49??__MACOSX\DemoExceptionHandler\DemoExceptionHandler\ba
?????文件?????????342??2018-09-07?11:12??DemoExceptionHandler\DemoExceptionHandler\main.m
?????文件?????????171??2018-09-07?11:12??__MACOSX\DemoExceptionHandler\DemoExceptionHandler\._main.m
?????文件????????2111??2018-09-07?11:29??DemoExceptionHandler\DemoExceptionHandler\AppDelegate.m
?????文件?????????176??2018-09-07?11:29??__MACOSX\DemoExceptionHandler\DemoExceptionHandler\._AppDelegate.m
?????目錄???????????0??2018-09-07?11:29??DemoExceptionHandler\DemoExceptionHandler\ExceptionHandler\
?????文件?????????869??2018-09-07?11:29??DemoExceptionHandler\DemoExceptionHandler\ExceptionHandler\UncaughtExceptionHandler.h
?????目錄???????????0??2018-09-07?15:14??__MACOSX\DemoExceptionHandler\DemoExceptionHandler\ExceptionHandler\
?????文件?????????176??2018-09-07?11:29??__MACOSX\DemoExceptionHandler\DemoExceptionHandler\ExceptionHandler\._UncaughtExceptionHandler.h
?????文件????????9064??2018-09-07?11:29??DemoExceptionHandler\DemoExceptionHandler\ExceptionHandler\UncaughtExceptionHandler.m
?????文件?????????333??2018-09-07?11:29??__MACOSX\DemoExceptionHandler\DemoExceptionHandler\ExceptionHandler\._UncaughtExceptionHandler.m
............此處省略133個文件信息
評論
共有 條評論