简体   繁体   English

application:didFinishLaunchingWithOptions:在应用崩溃时被调用的方法

[英]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 . 我通过显示UILocalNotificationNSUserDefaults对其进行了测试。

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.

相关问题 application:didFinishLaunchingWithOptions:在iPad上没有被调用 - application:didFinishLaunchingWithOptions: not getting called on iPad didFinishLaunchingWithOptions未调用,但应用程序正在运行并面临崩溃 - didFinishLaunchingWithOptions not called but app is running and faced with crash 远程通知“ application:didFinishLaunchingWithOptions:”方法未调用 - Remote Notification 'application:didFinishLaunchingWithOptions:' method not called didFinishLaunchingWithOptions方法崩溃 - Crash in the didFinishLaunchingWithOptions method application:didFinishLaunchingWithOptions没有被调用 - application:didFinishLaunchingWithOptions is not being called 甚至在申请之前我的应用程序在iPad上崩溃:didFinishLaunchingWithOptions: - My App crash on iPad before even application:didFinishLaunchingWithOptions: 当用户更新iOS应用程序时,应用程序:didFinishLaunchingWithOptions:被调用吗? - When a user updates an iOS app, does application:didFinishLaunchingWithOptions: get called? 调用didFinishLaunchingWithOptions时,应用崩溃 - App crashes when didFinishLaunchingWithOptions is called 在iOS崩溃应用上调用的方法 - Method called on crash iOS app application(_ application: UIApplication, didFinishLaunchingWithOptions) 未在启动时调用 - application(_ application: UIApplication, didFinishLaunchingWithOptions) not called on start up
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM