Re: Why NSClassFromString(@"CADisplayLink")?
Re: Why NSClassFromString(@"CADisplayLink")?
- Subject: Re: Why NSClassFromString(@"CADisplayLink")?
- From: "Hank Heijink (Mailinglists)" <email@hidden>
- Date: Tue, 10 May 2011 09:08:50 -0400
On May 10, 2011, at 6:34 AM, Brian Bruinewoud wrote:
> Hi All,
>
> Just curious, why does this work (compiles and runs):
>
> displayLink = [NSClassFromString(@"CADisplayLink") displayLinkWithTarget: tapped selector:@selector(respond:)];
>
> But this doesn't link because the CADisplayLink class is missing:
>
> displayLink = [CADisplayLink displayLinkWithTarget: tapped selector:@selector(respond:)];
>
> ??
If the class is missing, NSClassFromString(@"CADisplayLink") returns nil. When you say that it "compiles and runs", does that mean that line of code puts a non-nil value in displayLink? That would be interesting, but I suspect you're just calling a method on nil.
Hank
_______________________________________________
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