2016-05-11 7 views
0

ich Viewcontroller zu TargetViewController navigieren will, aber ich bin immer folgende Fehlermeldung:Navigation einen View-Controller zu einem anderen bekommen

2016-05-11 15:47:27.182 Sum of Numbers[2882:209790] *** Terminating app due to uncaught exception 'NSUnknownKeyException', reason: '[ setValue:forUndefinedKey:]: this class is not key value coding-compliant for the key bttn.'

*** First throw call stack: ( 0 CoreFoundation 0x00000001016f9f45 __exceptionPreprocess + 165 1 libobjc.A.dylib
0x0000000101173deb objc_exception_throw + 48 2 CoreFoundation
0x00000001016f9b89 -[NSException raise] + 9 3 Foundation
0x0000000100d40a6b -[NSObject(NSKeyValueCoding) setValue:forKey:] + 288 4 UIKit 0x0000000101c3104c -[UIViewController setValue:forKey:] + 88 5 UIKit 0x0000000101e5ea71 -[UIRuntimeOutletConnection connect] + 109 6
CoreFoundation 0x000000010163aa80 -[NSArray makeObjectsPerformSelector:] + 224 7 UIKit
0x0000000101e5d454 -[UINib instantiateWithOwner:options:] + 1864 8
UIKit 0x0000000101c37c16 -[UIViewController _loadViewFromNibNamed:bundle:] + 381 9 UIKit 0x0000000101c38542 -[UIViewController loadView] + 178 10 UIKit
0x0000000101c388a0 -[UIViewController loadViewIfRequired] + 138 11 UIKit 0x0000000101c39013 -[UIViewController view] + 27 12 UIKit 0x00000001023db7e7 -[_UIFullscreenPresentationController _setPresentedViewController:] + 87 13 UIKit 0x0000000101c08dde -[UIPresentationController initWithPresentedViewController:presentingViewController:] + 133 14 UIKit 0x0000000101c4b9ba -[UIViewController _presentViewController:withAnimationController:completion:] + 4004 15 UIKit 0x0000000101c4ec5c -[UIViewController _performCoordinatedPresentOrDismiss:animated:] + 489 16 UIKit 0x0000000101c4e76b -[UIViewController presentViewController:animated:completion:] + 179 17 Sum of Numbers 0x0000000100c756f8 -[ViewController Sum:] + 120 18 UIKit 0x0000000101aa7e91 -[UIApplication sendAction:to:from:forEvent:] + 92 19 UIKit 0x0000000101c134d8 -[UIControl sendAction:to:forEvent:] + 67 20 UIKit 0x0000000101c137a4 -[UIControl _sendActionsForEvents:withEvent:] + 311 21 UIKit 0x0000000101c128d4 -[UIControl touchesEnded:withEvent:] + 601 22 UIKit 0x0000000101b15ed1 -[UIWindow _sendTouchesForEvent:] + 835 23 UIKit 0x0000000101b16c06 -[UIWindow sendEvent:] + 865 24 UIKit
0x0000000101ac62fa -[UIApplication sendEvent:] + 263 25 UIKit
0x0000000101aa0abf _UIApplicationHandleEventQueue + 6844 26 CoreFoundation 0x0000000101626011 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 17 27 CoreFoundation 0x000000010161bf3c __CFRunLoopDoSources0 + 556 28 CoreFoundation 0x000000010161b3f3 __CFRunLoopRun + 867 29 CoreFoundation
0x000000010161ae08 CFRunLoopRunSpecific + 488 30 GraphicsServices
0x0000000104e95ad2 GSEventRunModal + 161 31 UIKit
0x0000000101aa630d UIApplicationMain + 171 32 Sum of Numbers
0x0000000100c75aaf main + 111 33 libdyld.dylib
0x0000000103e1d92d start + 1) libc++abi.dylib: terminating with uncaught exception of type NSException (lldb)

Mein viewController.m

@interface ViewController() 

@end 

@implementation ViewController 

- (void)viewDidLoad { 
    [super viewDidLoad]; 
    // Do any additional setup after loading the view, typically from a nib. 
} 

- (void)didReceiveMemoryWarning { 
    [super didReceiveMemoryWarning]; 
    // Dispose of any resources that can be recreated. 
} 

- (IBAction)Sum:(id)sender { 
    TargetViewController *add = [[TargetViewController alloc] 
            initWithNibName:@"TargetViewController123" bundle:nil]; 

    // TargetViewController *membr = [[TargetViewController alloc] initWithNibName:@"TargetViewController123"]; 

    [self presentViewController:add animated:YES completion:nil]; 
} 
@end 

Ich weiß nicht, wo Ich bekomme den Fehler. Bitte helfen

+1

Bitte bearbeiten Sie Ihre Frage und legen Sie sowohl das Fehlerprotokoll als auch Ihren Code in Codeblöcke, so dass es lesbar ist. Wie es jetzt ist, ist die Formatierung schrecklich. –

+0

Überprüfen Sie Ihre Steckdose im Storyboard, indem Sie mit der rechten Maustaste auf den gelben Knopf des View-Controllers klicken. –

Antwort

4

Ihr Fehler hier beschrieben wird:

Terminating app due to uncaught exception 'NSUnknownKeyException', reason: '[ setValue:forUndefinedKey:]: this class is not key value coding-compliant for the key bttn. 

Das bedeutet, dass etwas eine Eigenschaft bttn auf eine Klasse zu nennen versucht, die nicht eine Eigenschaft mit diesem Namen hat. Dies passiert häufig, wenn Sie in Ihrem View-Controller eine IBOutlet angeschlossen haben und diese dann im Code gelöscht haben, aber vergessen hat, die Ausgangsreferenz von Ihrem Element in Interface Builder zu entfernen.

+0

Hallo pagevic es funktioniert dank –

+0

Großartig. Sie könnten in Erwägung ziehen, die Antwort zu akzeptieren, wenn die Lösung korrekt war. – pajevic

Verwandte Themen