Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9020757
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T05:05:57+00:00 2026-06-16T05:05:57+00:00

I am trying to make a simple CAKeyframeAnimation using the following code: – (void)viewDidLoad

  • 0

I am trying to make a simple CAKeyframeAnimation using the following code:

- (void)viewDidLoad
{
    [super viewDidLoad];
    // Do any additional setup after loading the view.

    CALayer *rotLayer = [CALayer layer];
    rotLayer.bounds = CGRectMake(0.0, 0.0, 100.0, 50.0);
    rotLayer.anchorPoint = CGPointMake(0.5, 0.5);
    rotLayer.position = CGPointMake(160.0, 200.0);
    rotLayer.backgroundColor = [UIColor redColor].CGColor;

    [self.view.layer addSublayer:rotLayer];

    /*
    CABasicAnimation *basic = [CABasicAnimation animationWithKeyPath:@"transform.rotation.z"];
    basic.duration = 3.0;
    basic.fromValue = [NSNumber numberWithFloat:0.0];
    basic.toValue = [NSNumber numberWithFloat:2.0];

    [rotLayer addAnimation:basic forKey:@"basic"];
    */

    CAKeyframeAnimation *animation = [CAKeyframeAnimation animationWithKeyPath:@"transform.rotation.z"];
    animation.duration = 3.0;
    animation.keyTimes = @[ [NSNumber numberWithFloat:0.0], [NSNumber numberWithFloat:1.0] ];
    animation.values = @[ [NSNumber numberWithFloat:0.0], [NSNumber numberWithFloat:2.0] ];
    animation.timingFunctions = @[ [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionLinear], [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionLinear] ];
    animation.fillMode = kCAFillModeForwards;
    animation.removedOnCompletion = NO;

    [rotLayer addAnimation:animation forKey:@"test"];   
}

If i use the basic animation instead of the keyframe one, everything works as expected but if i run this code in simulator it crashes with following messages:

 -[CAKeyframeAnimation _copyRenderAnimationForLayer:]: unrecognized selector sent to instance 0x7558870
 *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[CAKeyframeAnimation _copyRenderAnimationForLayer:]: unrecognized selector sent to instance 0x7558870'

This is an ARC enabled new project. Even setting the animation as a property does not work. The QuartzCore framework is link also. What do i wrong?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-16T05:05:58+00:00Added an answer on June 16, 2026 at 5:05 am

    When I run this code it works just fine (a red rectangle rotates around the anchor point, which is in the center of the rectangle).

    Are you sure you properly linked the QuartzCore framework? And you imported <QuartzCore/QuartzCore.h> into your implementation file? It looks like _copyRenderAnimationForLayer: is an internal Apple method, so I’m not questioning its existence. However, if you haven’t properly linked or imported the file, your application wouldn’t know that method exists, and then throw the exception you’re seeing.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to make simple IMAP client using winsock/OpenSSL, is this possible without additional
i'm trying to make simple scheduler using Timer and TimerTask classses see the code
I'm trying to make simple script using jquery $post function to pass data to
I'm trying to make a simple Jabber client using the libstrophe library. It's going
I'm trying to make simple many-to-one association, using NHibernate.. I have class Recruit with
I'm trying to make simple cms; the code below is index.php. Now I can't
Im trying to make a simple scroll path using this plugin http://joelb.me/scrollpath/ and all
Trying to make a simple client that consumes a web service using RemObjects SDK,
Trying to make a simple jquery drop down here, here's my code so far:
I am trying to make simple java code that will check if a table

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.