Tôi cố gắng để gọi một phương thức trong một UIView từ appdelegate sử dụng NSNotificationCenter vô ích ..postNotificationName không gọi phương pháp quan sát
AppDelegate.m
[[NSNotificationCenter defaultCenter] postNotificationName:@"ProcessDidComplete" object:items];
Sau đó qua MainStoryboard, giao diện chính là nạp lớp mà điều khiển là MainViewController
trong MainViewController.h viewDidLoad tôi có
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(ProcessDidComplete:) name:@"ProcessDidComplete" object:nil];
và sau đó là phương pháp
- (void) ProcessDidComplete:(NSNotification *)pNotification
nhưng nó không bao giờ được gọi.
Cảm ơn bạn đã trợ giúp!
Vì vậy, bạn đăng thông báo và _after_ rằng bạn đăng ký một người quan sát cho nó? – JiaYow