SIGABRT 消息仅适用于 iOS5

发布于 2024-12-10 15:16:33 字数 2256 浏览 2 评论 0原文

我的应用程序遇到了奇怪的崩溃,这种情况只发生在 iOS5 上。问题似乎出在我的核心动画方法上,因为当我没有为 aAnimation.repeatCount 或 0 设置任何值时,它正在工作,但是当它旋转时,我使用 get 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;
}

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

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

东京女 2024-12-17 15:16:33

我认为问题是您将 toValue 设置为 NSValue,但关键路径是 transform.rotation,这不是一个 NSValue。您应该使用 transform 作为 keyPath,或者应该使用 transform.rotation.z (或任何轴)作为 keyPath 和一个简单的 NSNumber< /code> 作为您的值。

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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文