简体   繁体   中英

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 .

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).

The project is written in 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.

单击项目目标,将部署目标更改为9.3

Add below line in application:didFinishLaunchingWithOptions: method.

NSSetUncaughtExceptionHandler(&uncaughtExceptionHandler);

Then, add below code in your appDelegate to get cause of exception:

void uncaughtExceptionHandler(NSException *exception) {
  NSLog(@"Exception : %@", exception);
  NSLog(@"Stack Trace: %@", [exception callStackSymbols]);
  // Internal error reporting
}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM