こんにちは、通知センターを介してメッセージを送信する NSObject サブクラスがあり、オブジェクト nil に通知を送信していますが、通知を受信できる唯一のオブジェクトはそれらを送信するオブジェクトです
同時に 2 つの通知が送信されています (スレッドの問題かどうかをテストするため)。
[[NSNotificationCenter defaultCenter] postNotificationName:kWGAskingForAuthToken object:nil];
int status = 123;
NSDictionary *userInfo = [NSDictionary dictionaryWithObject:@"RAR" forKey:@"Status"];
NSNotification *note = [NSNotification notificationWithName:kWGAskingForAuthToken object:nil userInfo:userInfo];
[[NSNotificationCenter defaultCenter] performSelectorOnMainThread:@selector(postNotification:) withObject:note waitUntilDone:YES];
そして私のオブザーバーは同じくらい単純です
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(handleMyEvent:)name:kWGAskingForAuthToken object:nil];
通知を受信しない別のオブジェクトの同じオブザーバーです