开发者

Weird problems with program and debugger in xcode

Okay, I have a program that I'm trying to test on my iPad. I have it all set up so that the app is able to get on the iPad just fine, but running it on the iPad is a different story.

Now, the thing is, my program was working fine on the debug configuration, but now it won't work on that, either. It's strange, because before I was able to get to a certain part of the program before it crashed, but now it's crashing before that.

The debugger is hardly helping. When I use the debugger window, it will step into one line of code, and then suddenly jump back to another line of code.

I really don't understand what's going on. The crash is now o开发者_开发问答ccuring in a root view controller that I have set up, called 'FunctionMachineViewController. Here's the code for when it crashes:

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

GameViewController is supposed to initialize just fine, but the debugger shows it as uninitialized. I even tried setting it up in the header file instead, but the problem still happens. Has anyone else come across these problems? Any help would be greatly appreciated!

EDIT: Here's what the console says when it crashes:

[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'


Turns out that, when I went and changed the name of several UILabels in the header of GameViewController, I forgot to fix the names in the interface builder, too. Don't know if that was what was causing the debugger to act weird, but everything is working now!

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜