xcode中程序和调试器的奇怪问题

时间:2011-06-03 04:41:42

标签: objective-c xcode ipad

好的,我有一个我想在iPad上测试的程序。我已经完成了所有设置,以便应用程序能够在iPad上运行得很好,但在iPad上运行它是一个不同的故事。

现在,问题是,我的程序在调试配置上运行良好,但现在它也无法正常工作。这很奇怪,因为在我崩溃之前能够到达程序的某个部分之前,现在它已经崩溃了。

调试器几乎没有帮助。当我使用调试器窗口时,它将进入一行代码,然后突然跳回另一行代码。

我真的不明白发生了什么。崩溃现在出现在我设置的根视图控制器中,称为“FunctionMachineViewController”。这是崩溃时的代码:

-(IBAction)startOnePlayer:(id)sender
{
    GameViewController* GameView = [[GameViewController alloc] initWithNibName:nil bundle:nil];
    [GameView isOnePlayer:YES withLevel:startLevelNumber];
    [self presentModalViewController:GameView animated:YES];
}

GameViewController应该初始化很好,但调试器将其显示为未初始化。我甚至尝试在头文件中设置它,但问题仍然存在。还有其他人遇到过这些问题吗?任何帮助将不胜感激!

编辑:这是控制台崩溃时所说的内容:

[Session started at 2011-06-02 21:46:10 -0700.]
2011-06-02 21:46:13.309 FunctionMachine[5033:207] *** Terminating app due to uncaught     exception 'NSUnknownKeyException', reason: '[<GameViewController 0x4b2a890>     setValue:forUndefinedKey:]: this class is not key value coding-compliant for the key Yminus2.'
*** Call stack at first throw:
(
    0   CoreFoundation                      0x00dd55a9 __exceptionPreprocess + 185
    1   libobjc.A.dylib                     0x00f29313 objc_exception_throw + 44
    2   CoreFoundation                      0x00dd54e1 -[NSException raise] + 17
    3   Foundation                          0x0003d677 _NSSetUsingKeyValueSetter + 135
    4   Foundation                          0x0003d5e5 -[NSObject(NSKeyValueCoding) setValue:forKey:] + 285
    5   UIKit                               0x004c130c -[UIRuntimeOutletConnection connect] + 112
    6   CoreFoundation                      0x00d4b8cf -[NSArray makeObjectsPerformSelector:] + 239
    7   UIKit                               0x004bfd23 -[UINib instantiateWithOwner:options:] + 1041
    8   UIKit                               0x004c1ab7 -[NSBundle(UINSBundleAdditions) loadNibNamed:owner:options:] + 168
    9   UIKit                               0x00377628 -[UIViewController _loadViewFromNibNamed:bundle:] + 70
    10  UIKit                               0x00375134 -[UIViewController loadView] + 120
    11  UIKit                               0x0037500e -[UIViewController view] + 56
    12  UIKit                               0x00376a3d -[UIViewController viewControllerForRotation] + 63
    13  UIKit                               0x00372988 -[UIViewController _visibleView] + 90
    14  UIKit                               0x0061493c -[UIClientRotationContext initWithClient:toOrientation:duration:andWindow:] + 354
    15  UIKit                               0x002ec81e -[UIWindow _setRotatableClient:toOrientation:updateStatusBar:duration:force:] + 954
    16  UIKit                               0x00574619 -[UIWindowController transition:fromViewController:toViewController:target:didEndSelector:] + 1381
    17  UIKit                               0x0037965d -[UIViewController presentModalViewController:withTransition:] + 3478
    18  FunctionMachine                     0x00001fdd -[FunctionMachineViewController startOnePlayer:] + 227
    19  UIKit                               0x002c54fd -[UIApplication sendAction:to:from:forEvent:] + 119
    20  UIKit                               0x00355799 -[UIControl sendAction:to:forEvent:] + 67
    21  UIKit                               0x00357c2b -[UIControl(Internal) _sendActionsForEvents:withEvent:] + 527
    22  UIKit                               0x00356a1c -[UIControl touchesBegan:withEvent:] + 277
    23  UIKit                               0x002e9d41 -[UIWindow _sendTouchesForEvent:] + 395
    24  UIKit                               0x002cac37 -[UIApplication sendEvent:] + 447
    25  UIKit                               0x002cff2e _UIApplicationHandleEvent + 7576
    26  GraphicsServices                    0x0172d992 PurpleEventCallback + 1550
    27  CoreFoundation                      0x00db6944 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE1_PERFORM_FUNCTION__ + 52
    28  CoreFoundation                      0x00d16cf7 __CFRunLoopDoSource1 + 215
    29  CoreFoundation                      0x00d13f83 __CFRunLoopRun + 979
    30  CoreFoundation                      0x00d13840 CFRunLoopRunSpecific + 208
    31  CoreFoundation                      0x00d13761 CFRunLoopRunInMode + 97
    32  GraphicsServices                    0x0172c1c4 GSEventRunModal + 217
    33  GraphicsServices                    0x0172c289 GSEventRun + 115
    34  UIKit                               0x002d3c93 UIApplicationMain + 1160
    35  FunctionMachine                     0x00001c64 main + 102
    36  FunctionMachine                     0x00001bf5 start + 53
    37  ???                                 0x00000001 0x0 + 1
)
terminate called after throwing an instance of 'NSException'

1 个答案:

答案 0 :(得分:0)

事实证明,当我在GameViewController的标题中更改了几个UILabel的名称时,我忘了修改界面构建器中的名称。不知道是不是这导致调试器行为怪异,但现在一切正常!

相关问题