【问题标题】:SIGABRT message only with iOS5SIGABRT 消息仅适用于 iOS5
【发布时间】:2011-12-09 21:41:08
【问题描述】:

我的应用程序发生了奇怪的崩溃,该崩溃仅在 iOS5 中发生。问题似乎出在下面的核心动画方法上,因为当我没有为 aAnimation.repeatCount 或 0 设置任何值时,它正在工作,但是当它旋转时,我使用 get SIGABRT message with error: -[NSConcreteValue doubleValue]: unrecognized selector sent to当我触摸设备/模拟器屏幕时,实例为 0x9628100。

任何帮助将不胜感激

我的视图定义

-(无效)加载视图{ CGRect screenRect = [[UIScreen mainScreen] applicationFrame]; UIView *contentView = [[UIView alloc] initWithFrame:screenRect]; contentView.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight; self.view = contentView; [内容视图发布]; }

设置子视图

- (void)setUpPlacardView:(NSInteger)picture { // 创建标语牌视图——它的 init 方法根据它的图像计算它的框架 PlacardView *aPlacardView = [[PlacardView alloc] init:picture asColor:asColor]; aPlacardView.desaturation = kotucHue; self.placardView = aPlacardView; [aPlacardView 发布]; [self.view addSubview:placardView]; }

子视图定义

@interface PlacardView : UIView { UIImage *placardImage; 浮动饱和度; UIColor *barva; BOOL 开关模式; } @property (nonatomic, 保留) UIImage *placardImage; @property(非原子)浮点去饱和; @property (readwrite) BOOL switchMode; // 这个对象的初始化器 - (id)init:(NSInteger)图片asColor:(BOOL)farba; @结尾

旋转

- (void)makeKspinning { // 创建一个在 z 轴上旋转的变换 浮动弧度 = 3.120; CATransform3D变换; 如果(旋转){ 变换 = CATransform3DMakeRotation(弧度, 0.0, 0.0, 0.0); } 别的 变换 = CATransform3DMakeRotation(弧度, 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; }

【问题讨论】:

  • 如果你说它在哪一行崩溃会有所帮助。
  • 它实际上指向行“int retVal = UIApplicationMain(argc, argv, nil, @"AppDelegate");"在我的 main.m
  • 这只是有源的顶部框架。回溯将显示一堆操作系统函数,我敢打赌你会发现它在 CoreAnimation 的中间,试图访问动画对象。
  • 我和你有同样的问题。 iOS 5 特有的崩溃。

标签: ios uiview crash core-animation ios5


【解决方案1】:

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

【讨论】:

  • 我都试过了。第一个没有旋转,但没有崩溃。第二个和以前一样,在 iOS4.X 上工作正常,iOS5 触摸屏崩溃。
猜你喜欢
  • 2017-03-18
  • 2021-08-21
  • 1970-01-01
  • 1970-01-01
  • 2016-01-27
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多