0

I'm having one error and one warning concerning the usage of the 'GetTiming()' function. My colde is as follows:

[values addObject:[NSNumber numberWithFloat:25.0]];
[timings addObject:GetTiming(kCAMediaTimingFunctionEaseIn)];
[keytimes addObject:[NSNumber numberWithFloat:0.0]];

I am importing the following:

#import <QuartzCore/CAAnimation.h>
#import <QuartzCore/CAMediaTimingFunction.h>

The error I suppose is due to the fact that I'm using ARC, and says:

implicit conversion of 'int' to 'id' is disallowed with ARC.

I tried to disable ARC in the concerning file but the error persists.

About the warning, it says:

implicit declaration of function 'GetTiming' is invalid in C99

Any one have any ideas on how can I fix these issues? Thanks a lot!

Kazuki Sakamoto
  • 13,929
  • 2
  • 34
  • 96
Bruno Morgado
  • 507
  • 1
  • 8
  • 26

1 Answers1

2

First make sure that the GetTiming function exists (include the right header). Now if GetTiming returns an int the problem is you can not add a primitive value to an array. You need to wrap the value returned in an NSNumber.

[timings addObject:
    [NSNumber numberWithInt:GetTiming(kCAMediaTimingFunctionEaseIn)]];

Edit:

You are missing the function that was declared in JackController.m.

CAMediaTimingFunction* GetTiming(NSString* name) {
    return [CAMediaTimingFunction functionWithName:name];
}

For simplicity do not use that function, just create it directly.

[timings addObject:
    [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseIn]];
Community
  • 1
  • 1
Joe
  • 56,979
  • 9
  • 128
  • 135
  • It solved the ARC issue, however the warning still persists, and when try to build it fails with the message: Undefined symbols for architecture i386: "_GetTiming". Thanks anyway! – Bruno Morgado Dec 13 '11 at 21:25
  • You should explain what you are trying to do because you are calling `GetTiming` like it is a C function. And by the name of it it looks like it would be a function you wrote. I looked at the documentation for `CAMediaTimingFunction` and it is an Objective-C class and there is no function called `GetTiming`. There is an example in the Animation Pacing section here http://developer.apple.com/library/mac/#documentation/Cocoa/Conceptual/Animation_Types_Timing/Articles/Timing.html#//apple_ref/doc/uid/TP40006670-SW1 – Joe Dec 13 '11 at 21:28
  • I want to create an animation bounce effect in a similar way as proposed by Felz in this answer: http://stackoverflow.com/a/5161588/734702 – Bruno Morgado Dec 13 '11 at 21:44
  • @BrunoMorgado Answer updated, that should take care of your problem – Joe Dec 13 '11 at 21:51
  • Yeah, I totally missed it. Thanks very much! – Bruno Morgado Dec 13 '11 at 21:57