2

For some reason Xcode tells me that it doesn't find symbols as soon as I use something like kCAFillModeForwards. There must be a library or class that I have to include...but which one? The normal Core Animation stuff works fine like [myView beginAnimations...]. What's the trick to get the more sophisticated animation stuff to work?

I've included in the .h file:

#import <UIKit/UIKit.h>
#import <QuartzCore/QuartzCore.h>

@interface TestClass : UIView {

}
// ...

I run this code:

- (void)testAnimation {
    CABasicAnimation *fadeInAnimation = [CABasicAnimation animationWithKeyPath:@"opacity"];
    [fadeInAnimation setToValue:[NSNumber numberWithFloat:1.0]];
    fadeInAnimation.fillMode = kCAFillModeForwards;
    fadeInAnimation.removedOnCompletion = NO;
    // other stuff deleted to limit error possibilities...should at least compile
}

This happens when I build (did clean up lots of times), 2 Errors:

    cd "/Users/thanks/Desktop/Thanks/iPhone Development/TestApp"
    setenv MACOSX_DEPLOYMENT_TARGET 10.5
    setenv PATH "/Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin:/Developer/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin"
    /Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin/gcc-4.0 -arch i386 -isysroot /Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator2.2.1.sdk "-L/Users/thanks/Desktop/Thanks/iPhone Development/TestApp/build/Debug-iphonesimulator" "-F/Users/thanks/Desktop/Thanks/iPhone Development/TestApp/build/Debug-iphonesimulator" -filelist "/Users/thanks/Desktop/Thanks/iPhone Development/TestApp/build/TestApp.build/Debug-iphonesimulator/TestApp.build/Objects-normal/i386/TestApp.LinkFileList" -mmacosx-version-min=10.5 -framework Foundation -framework UIKit -framework CoreGraphics -o "/Users/thanks/Desktop/Thanks/iPhone Development/TestApp/build/Debug-iphonesimulator/TestApp.app/TestApp"
Undefined symbols:
  ".objc_class_name_CABasicAnimation", referenced from:
      literal-pointer@__OBJC@__cls_refs@CABasicAnimation in TestClassTestClass.o
  "_kCAFillModeForwards", referenced from:
      _kCAFillModeForwards$non_lazy_ptr in TestClass.o
ld: symbol(s) not found
collect2: ld returned 1 exit status
      ".objc_class_name_CABasicAnimation", referenced from:
          literal-pointer@__OBJC@__cls_refs@CABasicAnimation in TestClass.o
      "_kCAFillModeForwards", referenced from:
          _kCAFillModeForwards$non_lazy_ptr in TestClass.o
    ld: symbol(s) not found
    collect2: ld returned 1 exit status

It says Undefined symbols:

Must I include some framework?

I have already included:

CoreGraphics.framework Foundation.framework UIKit.framework

When I remove all the code, but import QuartzCore/QuartzCore.h, then I don't get any error. So I bet that import works, but not sure.

SOLVED

I missed to include the QuartzCore framework!!

Thanks
  • 40,109
  • 71
  • 208
  • 322
  • Perhaps instead of asking this question, you could have kept to the responses in the comments here: http://stackoverflow.com/questions/1142727/how-can-i-animate-the-movement-of-a-view-or-image-along-a-curved-path/1143095#1143095 – Brad Larson Jul 21 '09 at 12:54
  • If you wrote this to have a clear question with a clear answer, let me tell you: Your plan failed! – Nikolai Ruhe Jul 21 '09 at 13:32
  • You should award the answer to Jules. – Mark Ingram Mar 22 '13 at 11:40

2 Answers2

7

Are you importing quartz in your header?

#import <QuartzCore/QuartzCore.h>

QuartzCore includes the CAAnimation headers

Jason Harwig
  • 43,743
  • 5
  • 43
  • 44
  • Yes, I included it. Doesn't help. I'll update the question with more details. – Thanks Jul 21 '09 at 12:51
  • Looks like this actually was the problem according to your 'SOLVED" comment in the qustion. No? If so, you should award the question to Jason. – Matt Long Sep 14 '11 at 16:21
7

Probably you did not include the Quartz framework in your project.

To do so, choose your application target, go to the Build Phases tab and then under Link Binary With Libraries add the QuartzCore.framework.

Jules
  • 7,148
  • 6
  • 26
  • 50