简体   繁体   English

领域令牌有什么用?

[英]What is the realm token good for?

When initialising a Realm notification, it's required to set a token:初始化 Realm 通知时,需要设置令牌:

// Observe Realm Notifications
__weak typeof(self) weakSelf = self;
RLMRealm *realm = [RLMRealm defaultRealm];
self.token = [realm addNotificationBlock:^(NSString *note, RLMRealm * realm) {
    [weakSelf updateUI];
}];

I'm not 100% clear for what this is good for.我不是 100% 清楚这有什么好处。 Is is to keep a reference to self?是保持对self的引用?

I found possible answer: the token is required to remove the notification from a view.我找到了可能的答案:从视图中删除通知需要令牌。 With the notification there seem to be no reference to it.在通知中似乎没有提及它。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM