views:

1575

answers:

1

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!!

+1  A: 

Are you importing quartz in your header?

#import <QuartzCore/QuartzCore.h>

QuartzCore includes the CAAnimation headers

Jason Harwig
Yes, I included it. Doesn't help. I'll update the question with more details.
Thanks