Hello. I need send events in my app, but I don’t understand how to do it.
I define onNotifyRecieved method
@interface MainNavigationViewController : UINavigationController
- (void)onNotifyRecieved: (NSNotification*) notification;
@end
and try subscribe
@Selector("init")
override fun init(): UINavigationController {
val obj = super.init()
NSNotificationCenter.defaultCenter()
.addObserverSelectorNameObject(this, SEL("onNotifyRecieved:"), DrawerViewController.NOTIFICATION_ID, null)
return obj
}
@Selector("onNotifyRecieved:")
fun onNotifyRecieved(notification: Notification) {
val notifyInfo: NSDictionary<String, Int> = notification.userData as NSDictionary<String, Int>
println("Notify: ${notifyInfo["id"]}")
}
}
but it’s crash. I think problem with SEL(“onNotifyRecieved:”)
How to use NSNotificationCenter or these is some alternative?