为什么我的程序总是说"无法识别的选择器发送到实例"?

时间:2014-12-09 08:23:03

标签: ios swift crash

这是我的主要代码:

     @IBOutlet weak var avatar: UIImageView!
     @IBOutlet weak var nickname: UIButton!

    var tapGesture :UITapGestureRecognizer?

    self.tapGesture = UITapGestureRecognizer(target: self, action: "dealTap:")
    self.avatar.addGestureRecognizer(tapGesture!)

    nickname.addTarget(self, action: "dealModifyNickname:", forControlEvents: UIControlEvents.TouchUpInside)


    self.tapGesture = UITapGestureRecognizer(target: self, action: "dealTap:")
    //tapGesture?.numberOfTapsRequired = 1
    self.avatar.addGestureRecognizer(tapGesture!)

    nickname.addTarget(self, action: "dealModifyNickname:", forControlEvents: UIControlEvents.TouchUpInside)



//modify avatar
func dealTap(sender:AnyObject){
    println("dealTap,dealTap!!!")
    println("i am %x",self)
    Alterview.showMessage("a", delegate: self)
}

//modify nickname
func dealModifyNickname(sender:AnyObject){
    Alterview.showmessage("a", subtitle: "a", cancelbutton: "a", delegate:self)
}

我总是可以修改我的头像和昵称,它不会崩溃,但是一旦我点击其他空格(空格),它就会崩溃。它说“ - [__ NSCFType dealTap:]:无法识别的选择器已发送例如0x15e72160“

1 个答案:

答案 0 :(得分:0)

你确实需要发布确切的消息,但我认为这是因为你在dealTap中有showMessage(大写字母M),在dealModifyNickname中有showmessage(小写字母m)。