SIGABRT消息仅适用于iOS5

我正面临着我的应用程序的一个奇怪的崩溃,只发生在iOS5上。 这个问题似乎与我的核心动画方法bellow,因为当我没有为aAnimation.repeatCount或0设置值它正在工作,但是当它旋转我使用获取SIGABRT消息与错误: - [NSConcreteValue doubleValue]:无法识别的选择器发送到实例0x9628100当我触摸设备/模拟器屏幕。

任何帮助将不胜感激

我的视图定义

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

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

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

设置一个子视图

- (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];
}

子视图定义

@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

并进行旋转


- (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;
}

我认为这个问题是你的设置toValue一个NSValue ,但关键路径是transform.rotation ,这是不是一个NSValue 。 您应该使用transform为你的keyPath,或者你应该使用transform.rotation.z (或其他轴)作为的keyPath和简单NSNumber作为你的价值。

链接地址: http://www.djcxy.com/p/74207.html

上一篇: SIGABRT message only with iOS5

下一篇: Alternative to using CABasicAnimation callbacks?