gpt4 book ai didi

ios - 以 NSException 类型的未捕获异常终止 - Xcode

转载 作者:行者123 更新时间:2023-11-28 07:04:21 24 4
gpt4 key购买 nike

我正在使用 Xcode 6.4,在尝试使用我硬编码的后退按钮时出现以下错误:

2015-07-01 22:41:47.082 oby[14979:280903] -[oby.PhotoViewController popView]: unrecognized selector sent to instance 0x7f8112f24d90
2015-07-01 22:41:47.103 oby[14979:280903] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[oby.PhotoViewController popView]: unrecognized selector sent to instance 0x7f8112f24d90'
*** First throw call stack:
(
0 CoreFoundation 0x0000000105b92c65 __exceptionPreprocess + 165
1 libobjc.A.dylib 0x00000001076fdbb7 objc_exception_throw + 45
2 CoreFoundation 0x0000000105b9a0ad -[NSObject(NSObject) doesNotRecognizeSelector:] + 205
3 CoreFoundation 0x0000000105af013c ___forwarding___ + 988
4 CoreFoundation 0x0000000105aefcd8 _CF_forwarding_prep_0 + 120
5 UIKit 0x0000000106432d62 -[UIApplication sendAction:to:from:forEvent:] + 75
6 UIKit 0x000000010654450a -[UIControl _sendActionsForEvents:withEvent:] + 467
7 UIKit 0x00000001065438d9 -[UIControl touchesEnded:withEvent:] + 522
8 UIKit 0x000000010647f958 -[UIWindow _sendTouchesForEvent:] + 735
9 UIKit 0x0000000106480282 -[UIWindow sendEvent:] + 682
10 UIKit 0x0000000106446541 -[UIApplication sendEvent:] + 246
11 UIKit 0x0000000106453cdc _UIApplicationHandleEventFromQueueEvent + 18265
12 UIKit 0x000000010642e59c _UIApplicationHandleEventQueue + 2066
13 CoreFoundation 0x0000000105ac6431 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 17
14 CoreFoundation 0x0000000105abc2fd __CFRunLoopDoSources0 + 269
15 CoreFoundation 0x0000000105abb934 __CFRunLoopRun + 868
16 CoreFoundation 0x0000000105abb366 CFRunLoopRunSpecific + 470
17 GraphicsServices 0x000000010a676a3e GSEventRunModal + 161
18 UIKit 0x00000001064318c0 UIApplicationMain + 1282
19 oby 0x00000001053502b7 main + 135
20 libdyld.dylib 0x0000000107e33145 start + 1
21 ??? 0x0000000000000001 0x0 + 1
)
libc++abi.dylib: terminating with uncaught exception of type NSException

按钮:

let btn = UINavButton(title: "Back", direction: UIButtonDirection.Left, parentView: self.view)
btn.addTarget(self, action: "popView", forControlEvents: UIControlEvents.TouchUpInside)
self.view.addSubview(btn)

有人可以帮我解决这个问题吗?

谢谢!

最佳答案

像这样

btn.addTarget(self, action: "backAction", forControlEvents: UIControlEvents.TouchUpInside)
self.view.addSubview(btn)

func backAction() {
self.navigationController?.popViewControllerAnimated(true)
}

关于ios - 以 NSException 类型的未捕获异常终止 - Xcode,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31174838/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com