2017-06-02 59 views
0

此代碼的工作,並postSpamListUpdatedNotification被稱爲performSelector被稱爲但不performSelector:afterDelay

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

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

但如果我把它改成這樣,那麼postSpamListUpdateNotification不會被調用。爲什麼?

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

回答

1

您可能沒有此線程的runloop。 performSelector:withObject:afterDelay:需要一個runloop,但performSelector:不需要。