Saya mencoba meneruskan objek dari delegasi aplikasi saya ke penerima notifikasi di kelas lain.
Saya ingin lulus bilangan bulat messageTotal
. Sekarang saya punya:
Dalam Penerima:
- (void) receiveTestNotification:(NSNotification *) notification
{
if ([[notification name] isEqualToString:@"TestNotification"])
NSLog (@"Successfully received the test notification!");
}
- (void)viewDidLoad {
[super viewDidLoad];
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(dismissSheet) name:UIApplicationWillResignActiveNotification object:nil];
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(receiveTestNotification:) name:@"eRXReceived" object:nil];
Di kelas yang melakukan pemberitahuan:
[UIApplication sharedApplication].applicationIconBadgeNumber = messageTotal;
[[NSNotificationCenter defaultCenter] postNotificationName:@"eRXReceived" object:self];
Tapi saya ingin meneruskan objek messageTotal
ke kelas lain.