Ios swift类和objective-c视图控制器之间的NotificationCenter网络

Ios swift类和objective-c视图控制器之间的NotificationCenter网络,ios,objective-c,iphone,swift,Ios,Objective C,Iphone,Swift,在我的objective C类中,我添加了以下代码 [[NSNotificationCenter defaultCenter] postNotificationName:@"Notify" object:nil]; NotificationCenter.defaultCenter().addObserver(self, selector:(DataProcessingMethod), name:@"" , object: nil) 在我的Swift课程中,我添加了以下代码 [[NSNotif

在我的objective C类中,我添加了以下代码

[[NSNotificationCenter defaultCenter] postNotificationName:@"Notify" object:nil];
NotificationCenter.defaultCenter().addObserver(self, selector:(DataProcessingMethod), name:@"" , object: nil)
在我的Swift课程中,我添加了以下代码

[[NSNotificationCenter defaultCenter] postNotificationName:@"Notify" object:nil];
NotificationCenter.defaultCenter().addObserver(self, selector:(DataProcessingMethod), name:@"" , object: nil)

但不幸的是没有工作,代码有什么问题

应该是这样的:

NotificationCenter.default.addObserver(self, selector: #selector(DataProcessingMethod), name: NSNotification.Name(rawValue: "Notify"), object: nil)
您是否为确切的通知名称添加了观察员,因为观察员@“Notify”中没有名称