Re: No longer use NSLog() in Xcode 4?
Re: No longer use NSLog() in Xcode 4?
- Subject: Re: No longer use NSLog() in Xcode 4?
- From: Jerry Krinock <email@hidden>
- Date: Thu, 15 Sep 2011 11:57:45 -0700
On 2011 Sep 15, at 10:03, David Duncan wrote:
> If I understand correctly, they are associated with breakpoints (and I don't understand why it would take you 10s of seconds to turn them on, but that would probably make a worthy bug report).
Can't always reproduce. A few minutes ago, it took 42 seconds to activate breakpoints in a new Cocoa app project I started yesterday, but now it's done to a few seconds. No C++ here. I'll try to use it more and watch how it goes.
* * *
Thanks for all the tips on debugging; they all have their uses, but unfortunately none of them are new to me.
I'm interested in temporary NSLogs for quick debugs. A few permanent, conditional NSLogs are OK, but too many make code hard to read, and they're often fighting the last war. My User Scripts enabled me to shotgun in, say, 25 unique, ordered NSLogs by hitting ⌘D 25 times, then after the problem was solved, remove all of them in one keystroke, ⌘⎇⇧D. ⌘⎇D added an NSLog with a __PRETTY_FUNCTION__. These scripts did this by inserting a signature comment and cursor position into each one. Before shipping, I'd do a Project Find for that signature comment to make sure I didn't forget any. I'd been very happy with this.
But my scripts require that the current cursor position (%%%{PBXSelectionStart}%%%), and the text of the entire file be readable, insertable and replaceable from, say, Perl. These were features of User Scripts. Services only gives access to the selected text. AppleScript should be able to do it, I'm not sure how fast, but since AppleScriptability is so broken in Xcode 4.1, I've not been able to try. Behaviors can run scripts, but have no access to the text editor.
Yes I've reported bugs on both the User Scripts and the broken AppleScriptability. And we've discussed all this before in the list archives. So I was hoping there was a new trick which would allow me to enjoy the new features of Xcode 4 like all the rest of you happy hackers.
Still feel like I'm typing with two fingers when I want some NSLogs, though :(
Little by little. I guess I could use line number + some abbreviation of the filename instead of cursor position. If only AppleScript worked. _______________________________________________
Do not post admin requests to the list. They will be ignored.
Xcode-users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden