Shamsiddin Saidov
Shamsiddin Saidov

Reputation: 2281

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.

Upvotes: 1

Views: 749

Answers (2)

Vinit Ingale
Vinit Ingale

Reputation: 401

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
}

Upvotes: 2

Akash Singh Sisodia
Akash Singh Sisodia

Reputation: 136

Click on Project target, Change Deployment Target to 9.3

Upvotes: 0

Related Questions