performSelector被调用但不是performSelector:afterDelay

时间:2017-06-02 20:12:22

标签: ios objective-c

此代码有效,并且调用postSpamListUpdatedNotification

- (void) postSpamListUpdatedNotification
{
    [NIDPrivateUtils postNotification:kNIDSpamListsUpdated andError:nil];
}

[self performSelector:@selector(postSpamListUpdatedNotification) withObject:nil];

但如果我将其更改为此,则永远不会调用postSpamListUpdateNotification。为什么呢?

[self performSelector:@selector(postSpamListUpdatedNotification) withObject:nil afterDelay:2.0];

1 个答案:

答案 0 :(得分:1)

你可能在这个帖子上没有runloop。 performSelector:withObject:afterDelay:需要一个runloop,但performSelector:不需要。