gpt4 book ai didi

ios - 类 AppDelegate : UIResponder, UIApplicationDelegate { SWIFT 中的 SIGABIRT 错误

转载 作者:搜寻专家 更新时间:2023-11-01 07:22:32 24 4
gpt4 key购买 nike

我收到这个错误,我不知道为什么?今天开始学swift了

2016-06-28 02:40:03.393 Calculator[7072:173608] -[Calculator.ViewController touchDigit]: unrecognized selector sent to instance 0x7fc4a9465000
2016-06-28 02:40:03.400 Calculator[7072:173608] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[Calculator.ViewController touchDigit]: unrecognized selector sent to instance 0x7fc4a9465000'
*** First throw call stack:
(
0 CoreFoundation 0x0000000100c40e65 __exceptionPreprocess + 165
1 libobjc.A.dylib 0x0000000102980deb objc_exception_throw + 48
2 CoreFoundation 0x0000000100c4948d -[NSObject(NSObject) doesNotRecognizeSelector:] + 205
3 CoreFoundation 0x0000000100b9690a ___forwarding___ + 970
4 CoreFoundation 0x0000000100b964b8 _CF_forwarding_prep_0 + 120
5 UIKit 0x000000010145f194 -[UIApplication sendAction:to:from:forEvent:] + 92
6 UIKit 0x00000001015ce6fc -[UIControl sendAction:to:forEvent:] + 67
7 UIKit 0x00000001015ce9c8 -[UIControl _sendActionsForEvents:withEvent:] + 311
8 UIKit 0x00000001015cdaf8 -[UIControl touchesEnded:withEvent:] + 601
9 UIKit 0x00000001014ce49b -[UIWindow _sendTouchesForEvent:] + 835
10 UIKit 0x00000001014cf1d0 -[UIWindow sendEvent:] + 865
11 UIKit 0x000000010147db66 -[UIApplication sendEvent:] + 263
12 UIKit 0x0000000101457d97 _UIApplicationHandleEventQueue + 6844
13 CoreFoundation 0x0000000100b6ca31 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 17
14 CoreFoundation 0x0000000100b6295c __CFRunLoopDoSources0 + 556
15 CoreFoundation 0x0000000100b61e13 __CFRunLoopRun + 867
16 CoreFoundation 0x0000000100b61828 CFRunLoopRunSpecific + 488
17 GraphicsServices 0x0000000105256ad2 GSEventRunModal + 161
18 UIKit 0x000000010145d610 UIApplicationMain + 171
19 Calculator 0x0000000100a6361d main + 109
20 libdyld.dylib 0x000000010348992d start + 1
)
libc++abi.dylib: terminating with uncaught exception of type NSException
(lldb)

我的主类只有这个简单的方法不知道发生了什么

import UIKit

internal class ViewController : UIViewController {

@IBAction internal func touchDigit(sender: UIButton)
}

谢谢

最佳答案

尝试在 Storyboard/xib 中取消绑定(bind)您的操作,然后重新绑定(bind)它。

我根据错误中缺少的 : 进行猜测(它应该是 [ViewController touchDigit:] 因为有一个参数),你添加了参数 sender after 在 Storyboard中设置它。

我自己测试了这个,当重新绑定(bind)它时, Storyboard将它显示为 touchDigitWithSender,即使它保留名称 touchDigit。可能是一些奇怪的 Swift/Objective-C 互操作性问题。


附言internal 是默认的访问说明符,您不必将它添加到每个声明中

关于ios - 类 AppDelegate : UIResponder, UIApplicationDelegate { SWIFT 中的 SIGABIRT 错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38065375/

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