【发布时间】:2014-10-21 09:15:56
【问题描述】:
我使用addObserver API 接收通知:
NSNotificationCenter.defaultCenter().addObserver(self, selector: "methodOFReceivedNotication:", name:"NotificationIdentifier", object: nil)
我的方法是:
func methodOFReceivedNotication(notification: NSNotification){
//Action take on Notification
}
是的,它有效!
但是当我将方法 methodOFReceivedNotication 更改为私有时:
private func methodOFReceivedNotication(notification: NSNotification){
//Action take on Notification
}
xCode 发给我一个错误:unrecognized selector sent to instance
如何在目标为self 时调用私有方法?我不想将methodOFReceivedNotication 方法暴露给任何其他人。
【问题讨论】: