将Notification Center观察器添加到NSObject类

时间:2018-07-28 09:48:59

标签: ios iphone swift xcode9

试图将通知观察者添加到自定义类(基类是NSObject)中。

override init() {
    super.init()
    NotificationCenter.default.addObserver(self, selector: #selector(self.methodOfReceivedNotification(notification:)), name: Notification.Name("RegistrationCAll"), object: nil)
 }

无法接收事件。是否可以将观察者添加到nsobject自定义类?

0 个答案:

没有答案