Donnerstag, 29. April 2010

CABasicAnimation "undeclared"

If you are new on iPhone development or XCode you probably get the following error:

error: 'CABasicAnimation' undeclared (first use in this function)


But how to fix this issue?

  • First of all you have to learn, how to add a new framework to your include path. But what framework? Let's have al look at the class documentation: Link.
    As you can see, CABasicAnimation is part of the QuartzCore framework.
  • Now let's add this framework to your project. Locate in Xcode the "Framework" folder, press the right mouse button, choose "Add" => "Existing Frameworks...".
  • Choose "Quartz.Core.framework" and then press "Add".
  • Now you can go to the .m file where you want to use the CABasicAnimation and add the following line to the existing import statements:
    #import "QuartzCore/CAAnimation.h"
  • Compile your app

Keine Kommentare:

Kommentar veröffentlichen