簡體   English   中英

終止類型為NSException的未捕獲異常

[英]terminating uncaught exception of type NSException

重新啟動游戲后按某個按鈕后,我的游戲總是崩潰。

動畫始終在我正在運行游戲的ViewController中運行。

這是崩潰日志。 有什么方法可以檢測此崩潰與我的動畫有何關系?

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) 

當我按視圖中的按鈕時,應用程序崩潰。 這是動畫代碼:

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

很抱歉,如果代碼混亂了,我仍在學習和構建小型應用程序和游戲,以獲得更好的練習。 謝謝。

您應該刪除具有fullRotation.fromValue的行,因為它不應該為其分配CALayer。

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

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM