Ho il seguente codice:NSNotificationCenter un post fa sì che gli osservatori di essere chiamato due volte
[[NSNotificationCenter defaultCenter] postNotificationName:kNewsfeedFetchCompleted object:self userInfo:userinfo];
solo questo, in nessun altro posto. Ed ecco come ho impostato l'osservatore:
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(newsfeedFetchCompleted:) name:kNewsfeedFetchCompleted object:nil];
domanda è quando faccio un post il newsfeedFetchCompleted viene chiamato due volte .. come è questo possibile?
[[NSNotification defaultCenter] removeObserver: self] – janusbalatbat
cosa intendi? perché dovrei farlo? – xonegirlz
AddObserver potrebbe essere richiamato più volte per lo stesso oggetto, generando più notifiche. Dove stai chiamando addObserver? –