मैं अपने एप्लिकेशन प्रतिनिधि से किसी ऑब्जेक्ट को दूसरी कक्षा में एक सूचना रिसीवर को भेजने की कोशिश कर रहा हूं।
मैं पूर्णांक पास करना चाहता हूं messageTotal। अभी मेरे पास है:
रिसीवर में:
- (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];
अधिसूचना करने वाले वर्ग में:
[UIApplication sharedApplication].applicationIconBadgeNumber = messageTotal;
[[NSNotificationCenter defaultCenter] postNotificationName:@"eRXReceived" object:self];
लेकिन मैं ऑब्जेक्ट messageTotalको दूसरी कक्षा में पास करना चाहता हूं ।