在阅读NotificationCenter文档时,我发现了下面的示例代码,我想说明的是,这里的__block是什么意思?我想弄清楚的是,__block在这里是什么意思?我知道当使用__block时,block中的变量可以改变,但token并没有改变。
NSNotificationCenter * __weak center = [NSNotificationCenter defaultCenter];
id __block token = [center addObserverForName:@"OneTimeNotification"
object:nil
queue:[NSOperationQueue mainQueue]
usingBlock:^(NSNotification *note) {
NSLog(@"Received the notification!");
[center removeObserver:token];
}];