[英]application:didFinishLaunchingWithOptions: method getting called on app crash
Please, someone, give me solution how to solve this problem? 请有人给我解决方案如何解决这个问题?
I don't know why 我不知道为什么
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
method is getting called on app crash (crash is created by myself to observe this problem, and I can fix this crash). 方法在应用崩溃时被调用(崩溃是由我自己创建的,以观察此问题,我可以解决此崩溃)。 I tested it by showing
UILocalNotification
and NSUserDefaults
. 我通过显示
UILocalNotification
和NSUserDefaults
对其进行了测试。
The problem is actually observed on iPhone 6 with iOS 9.3.2
, But with iPhone 5C with iOS 10.0.2
everything is OK ( application:didFinishLaunchingWithOptions:
method is not getting called on app crash). 实际上,此问题是在
iPhone 6 with iOS 9.3.2
观察到的,但是对于iPhone 5C with iOS 10.0.2
一切正常( application:didFinishLaunchingWithOptions:
程序崩溃时未调用application:didFinishLaunchingWithOptions:
方法)。
The project is written in Objective C
. 该项目用
Objective C
编写。
To observe this problem there should be the real crash, not taking an app into background/inactive
state and swiping it up by the user. 要观察此问题,应该发生真正的崩溃,不要使应用程序进入
background/inactive
状态并由用户将其向上滑动。
单击项目目标,将部署目标更改为9.3
Add below line in application:didFinishLaunchingWithOptions: method. 在application:didFinishLaunchingWithOptions:方法中添加以下行。
NSSetUncaughtExceptionHandler(&uncaughtExceptionHandler);
Then, add below code in your appDelegate to get cause of exception: 然后,在appDelegate中添加以下代码以获取异常原因:
void uncaughtExceptionHandler(NSException *exception) {
NSLog(@"Exception : %@", exception);
NSLog(@"Stack Trace: %@", [exception callStackSymbols]);
// Internal error reporting
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.