13

I've set an "All Exceptions" exception breakpoint for my project. In Xcode 7, it mysteriously fires on launch in main.m, but there doesn't seem to be anything obviously wrong. On continuing, the app runs normally.

Even running the project in Xcode 6 now causes this breakpoint to fire.

screenshot of breakpoint

I can't figure out what is causing this. The threads don't indicate anything specific to what the cause is.

Maybe it's some sort of font issue in the Storyboard or something? Does anyone know a fix?

NOTE: It's a C++ exception, not Objective-C. Perhaps due to missing fonts. Xcode throws an exception in Main() in iOS 8 with 'all exceptions' breakpoint

Clay Bridges
  • 11,602
  • 10
  • 68
  • 118
Ben Guild
  • 4,881
  • 7
  • 34
  • 60
  • Maybe you've set a breakpoints for 'All exceptions'? Check the breakpoints tab – Shai Jun 14 '15 at 08:28
  • Yes, but like I said... it shouldn't be an issue. – Ben Guild Jun 14 '15 at 08:29
  • Your terminology is incorrect; it's not a breakpoint (which is something *you* add during debugging), but rather a crash. Have you enabled a breakpoint as per the accepted answer in the question you linked? – Droppy Jun 14 '15 at 08:40
  • It doesn't actually "crash" at that point if the breakpoints aren't enabled. I have a breakpoint set on All Exceptions so that I can debug crashes. Yet, if I disable the breakpoint, it doesn't break there. So the point at which it breaks is a "phantom". – Ben Guild Jun 14 '15 at 08:47
  • Did you add accidentally that breakpoint there? Did you try to remove it? – BlackM Jun 14 '15 at 09:01
  • It's the default breakpoint for all exceptions. – Ben Guild Jun 15 '15 at 08:09
  • I reworded the question, to make clear that the firing of the breakpoint is mysterious, the _presence_ of the breakpoint is not. – Clay Bridges Jul 09 '15 at 19:45
  • I figured the same issue, all exceptions breakpoint stops in main.m after application started. When disabled, app starts normaly. Changing breakpoint type to objective-C only fixed this. – Dren Aug 05 '15 at 08:44
  • 1
    +1, I ran into this same issue when creating a dictionary of text attributes in application:didFinishLaunchingWithOptions: – Todd Anderson Sep 23 '15 at 17:42
  • I've got the same behaviour as @ToddAnderson - NSDictionary during launch was the culprit. – Simon Robb Jan 19 '17 at 01:45
  • It may be firing because the previous instance you were debugging was killed by Xcode when you started the new instance. Does it happen on the first launch of the app (just after you start Xcode) or only on subsequent launches? – par Jan 19 '17 at 01:59

2 Answers2

26

I have almost the identical problem in Xcode 7, as of beta 3. This workaround solved it for me.

Because it's a C++ exception, you can change your "All Exceptions" breakpoint to catch only Objective-C exceptions. Having done this, I no longer hit the mystery break on startup, and because I'm not writing C++, get 99% of the value of having the "All Exceptions" break point on.

Here's how:

  1. Go to the breakpoints tab (View > Navigators > Show Breakpoint Navigator or ⌘7).
  2. Right click on the All Exceptions breakpoint and "Edit Breakpoint..."

edit breakpoint

  1. Change the Exceptions covered to Objective-C only.

enter image description here

Clay Bridges
  • 11,602
  • 10
  • 68
  • 118
0

I started seeing the same behaviour in my application using the shorthand dictionary initialisation @{ ...: ... } in the willFinishLaunchingWithOptions function.

The problem was solved by replacing it with dictionaryWithObjectsAndKeys instead. I'm not sure if this was specific to my case or if the compiler has some kind of a problem with the shorthand syntax, but it's worth checking out if you're using that syntax.

Simon Robb
  • 1,668
  • 1
  • 14
  • 25