简体   繁体   English

终止类型为NSException的未捕获异常

[英]terminating uncaught exception of type NSException

My game is constantly crashing after pressing a certain button after restarting the game. 重新启动游戏后按某个按钮后,我的游戏总是崩溃。

An animation is always running during the game in the ViewController I'm running the game on. 动画始终在我正在运行游戏的ViewController中运行。

Here is the crash log. 这是崩溃日志。 Is there any way to detect how is this crash related to my animation? 有什么方法可以检测此崩溃与我的动画有何关系?

2014-08-05 00:21:30.044 windmill[702:90b] -[CALayer doubleValue]: unrecognized selector sent to instance 0xec32a10
2014-08-05 00:21:30.053 windmill[702:90b] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[CALayer doubleValue]: unrecognized selector sent to instance 0xec32a10'
*** First throw call stack:
(
    0   CoreFoundation                      0x01c501e4 __exceptionPreprocess + 180
    1   libobjc.A.dylib                     0x019cf8e5 objc_exception_throw + 44
    2   CoreFoundation                      0x01ced243 -[NSObject(NSObject) doesNotRecognizeSelector:] + 275
    3   CoreFoundation                      0x01c4050b ___forwarding___ + 1019
    4   CoreFoundation                      0x01c400ee _CF_forwarding_prep_0 + 14
    5   QuartzCore                          0x0013b9b8 CAObject_setValueForKeyPath_ + 2435
    6   QuartzCore                          0x0012129b -[CALayer setValue:forKeyPath:] + 471
    7   QuartzCore                          0x00105d51 -[CABasicAnimation applyForTime:presentationObject:modelObject:] + 1178
    8   QuartzCore                          0x0012415c _ZN2CA5Layer18presentation_layerEPNS_11TransactionE + 494
    9   QuartzCore                          0x00127cbe -[CALayer presentationLayer] + 43
    10  UIKit                               0x006eb0f1 _UIViewEatsTouches + 142
    11  UIKit                               0x006eb250 -[UIView(Geometry) hitTest:withEvent:] + 114
    12  UIKit                               0x006eb4f4 __38-[UIView(Geometry) hitTest:withEvent:]_block_invoke + 132
    13  CoreFoundation                      0x01cccd86 __53-[__NSArrayM enumerateObjectsWithOptions:usingBlock:]_block_invoke + 102
    14  CoreFoundation                      0x01cccc5f -[__NSArrayM enumerateObjectsWithOptions:usingBlock:] + 239
    15  UIKit                               0x006eb35c -[UIView(Geometry) hitTest:withEvent:] + 382
    16  UIKit                               0x006eb4f4 __38-[UIView(Geometry) hitTest:withEvent:]_block_invoke + 132
    17  CoreFoundation                      0x01cccd86 __53-[__NSArrayM enumerateObjectsWithOptions:usingBlock:]_block_invoke + 102
    18  CoreFoundation                      0x01cccc5f -[__NSArrayM enumerateObjectsWithOptions:usingBlock:] + 239
    19  UIKit                               0x006eb35c -[UIView(Geometry) hitTest:withEvent:] + 382
    20  UIKit                               0x006daeb1 __54+[UIWindow _hitTestToPoint:pathIndex:forEvent:screen:]_block_invoke + 175
    21  UIKit                               0x006dad1e +[UIWindow _topVisibleWindowPassingTest:] + 198
    22  UIKit                               0x006dadfa +[UIWindow _hitTestToPoint:pathIndex:forEvent:screen:] + 176
    23  UIKit                               0x0068c5bb _UIApplicationHandleEventQueue + 7975
    24  CoreFoundation                      0x01bd977f __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 15
    25  CoreFoundation                      0x01bd910b __CFRunLoopDoSources0 + 235
    26  CoreFoundation                      0x01bf61ae __CFRunLoopRun + 910
    27  CoreFoundation                      0x01bf59d3 CFRunLoopRunSpecific + 467
    28  CoreFoundation                      0x01bf57eb CFRunLoopRunInMode + 123
    29  GraphicsServices                    0x0341c5ee GSEventRunModal + 192
    30  GraphicsServices                    0x0341c42b GSEventRun + 104
    31  UIKit                               0x0068ff9b UIApplicationMain + 1225
    32  windmill                            0x00004afd main + 141
    33  libdyld.dylib                       0x03103725 start + 0
    34  ???                                 0x00000001 0x0 + 1
)
libc++abi.dylib: terminating with uncaught exception of type NSException
(lldb) 

When I press buttons in the view , the app crashes. 当我按视图中的按钮时,应用程序崩溃。 Here is the animation code: 这是动画代码:

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

    fullRotation.fromValue = [NSNumber numberWithFloat:0];
    fullRotation.toValue = [NSNumber numberWithFloat:((360*M_PI)/180)];
    fullRotation.duration = 4;
    fullRotation.repeatCount= 1000;
    [[stick layer] addAnimation:fullRotation forKey:@"60"];}

I'm sorry if the code is messed up , I'm still learning and building small apps and games to get a better practice. 很抱歉,如果代码混乱了,我仍在学习和构建小型应用程序和游戏,以获得更好的练习。 Thanks. 谢谢。

您应该删除具有fullRotation.fromValue的行,因为它不应该为其分配CALayer。

fullRotation.fromValue = self.view.layer.presentationLayer;

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM