4
votes

I'm facing a strange crash of my app that occurs only with iOS5. The problem seems to be with my core animation method bellow, because when I set no value for aAnimation.repeatCount or 0 it is working, but when it rotates I use get SIGABRT message with error: -[NSConcreteValue doubleValue]: unrecognized selector sent to instance 0x9628100 when I touch device/simulator screen.

any help will be appreciated

My view definition

- (void)loadView {
    CGRect screenRect = [[UIScreen mainScreen] applicationFrame];

    UIView  *contentView = [[UIView alloc] initWithFrame:screenRect];
    contentView.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight;

    self.view = contentView;
    [contentView release];
}

setting a subView

- (void)setUpPlacardView:(NSInteger)picture {
    // Create the placard view -- its init method calculates its frame based on its image
    PlacardView *aPlacardView = [[PlacardView alloc] init:picture asColor:asColor];
    aPlacardView.desaturation = kotucHue;
    self.placardView = aPlacardView;
    [aPlacardView release];
    [self.view addSubview:placardView];
}

SubView definition

@interface PlacardView : UIView {


    UIImage                 *placardImage;
    float                   saturation;
    UIColor                 *barva;
    BOOL                    switchMode;



}

@property (nonatomic, retain) UIImage *placardImage;
@property (nonatomic)       float     desaturation;
@property (readwrite) BOOL              switchMode;


// Initializer for this object
- (id)init:(NSInteger)picture asColor:(BOOL)farba;


@end

and make rotation


- (void)makeKspinning
{
    // Create a transform to rotate in the z-axis
    float radians = 3.120;   
    CATransform3D transform;
    if (rotation) {
        transform = CATransform3DMakeRotation(radians, 0.0, 0.0, 0.0);
    }
    else
        transform = CATransform3DMakeRotation(radians, 0.0, 0.0, 1.0);


    CABasicAnimation *aAnimation;
    aAnimation = [CABasicAnimation animationWithKeyPath:@"transform.rotation"];

        CALayer *pLayer = placardView.layer;

        aAnimation.toValue = [NSValue valueWithCATransform3D:transform];
        aAnimation.duration = spinSpeed;
        aAnimation.cumulative = YES;
        aAnimation.repeatCount = HUGE_VALF; 

        [pLayer addAnimation:aAnimation forKey:@"animatePlacardViewToSpin"];

        pLayer.opacity = spinOpacity;
}
1
It would help if you say what line it's crashing on.Lily Ballard
it is actually pointing at line "int retVal = UIApplicationMain(argc, argv, nil, @"AppDelegate");" in my main.mVanya
That's just the top frame that has source. The backtrace will show a bunch of OS functions instead, and I bet you'll find it's in the middle of CoreAnimation, trying to access the animation object.Lily Ballard
I have the same problem with you. iOS 5-specific crash.Raptor

1 Answers

3
votes

I think the problem is you're setting the toValue to an NSValue, but the key path is transform.rotation, which is isn't an NSValue. You should either be using transform as your keyPath, or you should be using transform.rotation.z (or whatever axis) as the keyPath and a simple NSNumber as your value.