Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Xcode throws an exception in Main() in iOS 8 with 'all exceptions' breakpoint

I am using Xcode 6 (GM, I didn't download betas), and I am developing apps for iOS 7+. For all my projects, I just opened the same projects I used to work on in Xcode 5.

In the Breakpoint navigator, I have the All Exceptions breakpoint on. It is set to Break: On Throw. Now, each time I run my app (whether on a device or in simulator), it stops execution on the line return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class])); in the main() function.

If I press Play to continue program execution twice, the program runs fine. So this doesn't prevent me from working, but it is annoying to have to manually play the execution each time and reset my editors.

I like the behaviors I have set up in Xcode (taking the current editor to where the execution has paused), and having that All Exceptions breakpoint is important IMO. (So I don't want to change those)

By running the same code, with the same environnements, for an iOS 7 target (again, device or simulator), the exception is not thrown.

Any clue what could cause this strange behavior?

like image 558
invalidArgument Avatar asked Sep 30 '14 17:09

invalidArgument


1 Answers

As stated in the comments, you should turn off catching the C++ exceptions by editing your All Exceptions breakpoint.

In order to do that, right click on your breakpoint and change Exception from All to Objective-C:

change All to Objective-C

Exceptions in C++ code are part of normal app functionality. However, exception breakpoint is not catching unhandled but every raised exceptions, even when they're handled correctly later on, hence the stop in execution.

like image 60
Johnnywho Avatar answered Oct 02 '22 15:10

Johnnywho