• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Why NSClassFromString(@"CADisplayLink")?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Why NSClassFromString(@"CADisplayLink")?


  • Subject: Re: Why NSClassFromString(@"CADisplayLink")?
  • From: Brian Bruinewoud <email@hidden>
  • Date: Wed, 11 May 2011 20:17:05 +1000

Thanks for the various answers.

Hank said:
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?

My Response:
The code functions only because displayLink is non-Nil. So NSClassFromString is returning something otherwise my display link delegate would never get called.

David said:
These types of link errors typically indicate that you forgot to link a necessary framework, in this case QuartzCore.framework

My Response:
Ok. But I'm using core animation in my app, which requires that framework anyway so I assume it would be included. If not, then why is anything running? Will it die when I try to run it on the real device (something I can't test at the moment)?

FYI:
This code was from the Apple Sample code - for an OpenGL iPhone app, I believe.

Thanks for your answers - I'll check the XCode project as soon as I'm able.

On 10/05/2011, at 20:34 , 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:)];
>
> ??
>
> Link error is:
>
> Undefined symbols for architecture i386:
>  "_OBJC_CLASS_$_CADisplayLink", referenced from:
>      objc-class-ref in drawingViewController.o
> ld: symbol(s) not found for architecture i386
> collect2: ld returned 1 exit status
>
> Using XCode 4.0 and the iPad simulator. I suppose if I compiled for ARM the error might go away (but I don't have provisioning profile so I can't test that). Still, the code still runs so it must be able to link at run time even if it can't at compile time, which seems strange.
>
> Anyway, just curious.
>
> Regards,
> Brian.
>
> _______________________________________________
>
> 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

_______________________________________________

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

References: 
 >Why NSClassFromString(@"CADisplayLink")? (From: Brian Bruinewoud <email@hidden>)

  • Prev by Date: Re: PDFDocument and CGPDFDocument
  • Next by Date: Re: PDFDocument and CGPDFDocument
  • Previous by thread: Re: Why NSClassFromString(@"CADisplayLink")?
  • Next by thread: Re: IB 3x plug-in: How to add custom control which is NSMatrix with custom controls inside?
  • Index(es):
    • Date
    • Thread