__weak NSNotificationCenter *center = [NSNotificationCenter defaultCenter];
id __block obj = [[NSNotificationCenter defaultCenter] addObserverForName:@"2" object:self queue:[[NSOperationQueue alloc] init] usingBlock:^(NSNotification * _Nonnull note) {
NSLog(@"%@\n%@", note, [NSThread currentThread]);
[center removeObserver:obj];
}];
网友评论