1

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.

Shamsiddin Saidov
  • 2,281
  • 4
  • 23
  • 35
  • Put a breakpoint in that function then post a screenshot of the stacktrace of when this breakpoint is hit. – deadbeef Jun 27 '17 at 15:01

2 Answers2

1

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
}
Vinit Ingale
  • 381
  • 1
  • 4
  • 17
0

Click on Project target, Change Deployment Target to 9.3