Re: NSAssert no longer displaying reason in console
Re: NSAssert no longer displaying reason in console
- Subject: Re: NSAssert no longer displaying reason in console
- From: Matt Neuburg <email@hidden>
- Date: Tue, 01 Nov 2011 19:47:28 -0700
On Nov 1, 2011, at 5:25 PM, Kyle Sluder wrote:
> On Nov 1, 2011, at 7:38 PM, Matt Neuburg <email@hidden> wrote:
>
>>
>> Sorry to keep harping on this, but this is a serious bug. As Ben Kennedy says, it isn't just NSAssert. iOS often throws a fatal exception with an absolutely lovely informative log message explaining the problem (e.g., your view controller loaded a nib but the view outlet wasn't hooked up). That log message is now being suppressed! The user never sees it. Surely Apple cannot intend that Xcode should be swallowing these informative log messages??? m.
>
> Here's my WAG: are you sure you didn't turn on the "All Objective-C Exceptions" breakpoint, and are therefore breaking in objc_exception_throw before the log message whereas you are used to waiting until the default uncaught exception handler logs the exception message and raises a signal?
>
> --Kyle Sluder
> (Sent from the road)
Well, when you get back from the road, try it. And here's what to try: Start with Xcode 4.2's Single View Application template and make a new iOS application with ARC. Go into the nib (ViewController.xib) and disconnect the "view" outlet from the file's owner to the view. Save. Build and run with no breakpoints on.
On my machine, what happens is that we SIGABRT with the editor falling into main.c and no logging of any kind in the console.
Now, *if* you set up a breakpoint on objc_exception_throw *and* you add an action to "po $eax" *and* that breakpoint is turned on *and* you are using the LLDB debugger in your scheme's debug action, and you run this project, you'll break at a reasonable spot ([self.window makeKeyAndVisible]) and you'll see in the console the delightful and helpful message, "Loaded the ViewController nib but the view outlet was not set."
But that is a *lot* of ifs. A lot more ifs than we can expect of, say, a beginner. (For one thing, the templates don't use the LLDB debugger. For another, what beginner has heard of $eax?) And yet this console message is helpful particularly for beginners. Why is Xcode suppressing it? This is new behavior under Xcode 4.2; in Xcode 4.0, the message just appeared, all by itself.
m.
--
matt neuburg, phd = email@hidden, http://www.apeth.net/matt/
pantes anthropoi tou eidenai oregontai phusei
Among the 2007 MacTech Top 25, http://tinyurl.com/2rh4pf
Programming iOS 4! http://www.apeth.net/matt/default.html#iosbook
RubyFrontier! http://www.apeth.com/RubyFrontierDocs/default.html
TidBITS, Mac news and reviews since 1990, http://www.tidbits.com
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden