【发布时间】:2017-08-30 20:23:57
【问题描述】:
单击按钮出现错误:无法识别的选择器发送到实例 - IOS Swift 3
import UIKit
class Login: UIViewController {
override func viewDidLoad() {
super.viewDidLoad()
// Do any additional setup after loading the view.
}
override func didReceiveMemoryWarning() {
super.didReceiveMemoryWarning()
// Dispose of any resources that can be recreated.
}
@IBAction func LoginButton(_ sender: UIButton) {
print("Login button")
}}
错误 2017-04-05 14:55:56.965 设计 [3510:67974] Interface Builder 文件中的未知类登录。 2017-04-05 14:56:00.084 设计[3510:67974]-[UIView LoginButton:]:无法识别的选择器发送到实例 0x7ffa2f70c9b0 2017-04-05 14:56:00.093 设计[3510:67974] * 由于未捕获的异常“NSInvalidArgumentException”而终止应用程序,原因:“-[UIView LoginButton:]:无法识别的选择器发送到实例 0x7ffa2f70c9b0” * 首先抛出调用栈: ( …… ) libc++abi.dylib:以 NSException 类型的未捕获异常终止
【问题讨论】:
-
您是否已将您的课程分配给您的视图控制器?
-
你的目标无效
-
尝试删除该操作并重新添加。
-
@iPeter 是的,我做到了,它在我的 Main.storyBoard 中的第二个屏幕
-
@Sneha 我做了很多次。