Re: Is this a bug, or am I hacking? [SOLVED]
Re: Is this a bug, or am I hacking? [SOLVED]
- Subject: Re: Is this a bug, or am I hacking? [SOLVED]
- From: Graham Cox <email@hidden>
- Date: Sat, 16 Aug 2008 00:38:01 +1000
On 15 Aug 2008, at 11:53 pm, Keary Suska wrote:
What if we bark up the tree of the "object" parameter? If you are
passing
this parameter, you will only receive notifications from the specific
object. It sounds like you are working with two different objects
that you
want to receive notifications for. In this case, you will have to
pass nil
for the object, and possibly test the object for interest in your
OK red-face time. I started to write a lengthy reply with the actual
code and so forth, and in so doing found the real bug. And of course,
it's in my code, where else ;-)
Typically I do this:
// header:
extern NSString* kSomeConstant;
// .m
NSString* kSomeConstant = @"kSomeConstant";
That is, the actual string is literally the same characters as the
constant itself, which appears to be the convention in Cocoa also. In
fact I do this so automatically that I *assumed* that the constant in
the framework was defined that way, so when I "aliased" the constant
in my local code, I just used the characters of the first constant.
However, for reasons which have to do with changing names of various
things in the framework over time, there are a handful of constants
that are not literally the same as their actual character strings, and
this is one of them. So the bug is blindingly obvious - the strings
are not the same. D'oh!
Had I done this:
#define kMyAliasedConstant kSomeConstant
I would have been OK.
Anyway, it's been useful to discuss the issue because I think the idea
of trying to make one notification look like another isn't such a
great one after all, so thanks to all who helped.
cheers, Graham
_______________________________________________
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