Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save SquaredTiki/221214 to your computer and use it in GitHub Desktop.
Save SquaredTiki/221214 to your computer and use it in GitHub Desktop.
// Code in App Delegate.
- (void) awakeFromNib {
NSNotificationCenter *nc;
nc = [NSNotificationCenter defaultCenter];
[nc addObserver:self
selector:@selector(syncKVO:)
name:NSManagedObjectContextObjectsDidChangeNotification
object:nil];
}
- (void)syncKVO:(id)sender {
NSNotificationCenter *nc;
nc = [NSNotificationCenter defaultCenter];
[nc removeObserver:self
name:NSManagedObjectContextObjectsDidChangeNotification
object:nil];
// Do stuff.
[nc addObserver:self
selector:@selector(syncKVO:)
name:NSManagedObjectContextObjectsDidChangeNotification
object:nil];
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment