SIGABRT消息只与iOS5 [英] SIGABRT message only with iOS5

查看:360
本文介绍了SIGABRT消息只与iOS5的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我面临的是一个奇怪的应用程序崩溃,只发生在iOS5。问题似乎是我的核心动画方法下面,因为当我设置没有值为aAnimation.repeatCount或0它正在工作,但当它旋转我使用get SIGABRT消息与错误: - [NSConcreteValue doubleValue]:无法识别的选择器发送到

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.

任何帮助将被欣赏

我的视图定义


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

SubView定义


@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 作为你的值。

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.

这篇关于SIGABRT消息只与iOS5的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆