0

I'm updating a button based on if I have local notifications set on my iOS app. I'd like to do this with KVO, as there are various ways notifications can be set so I won't be easily able to track when a change is made to the local notifications otherwise.

I'm setting it up like this:

        [[UIApplication sharedApplication] addObserver:self
                                        forKeyPath:@"scheduleLocalNotifications"
                                           options:NSKeyValueObservingOptionInitial
                                           context:NULL];

but the problem is, apart from the initial call I'm not getting anything come through into my observer method

- (void)observeValueForKeyPath:(NSString *)keyPath ofObject:(id)object change:(NSDictionary *)change context:(void *)context

Am I doing something wrong in my addObserver method or is there another way I can be notified of my scheduled local notifications?

Mark Bridges
  • 8,228
  • 4
  • 50
  • 65

1 Answers1

1
  1. The property's name is scheduledLocalNotifications (you missed the d).
  2. This property is not KVO compliant. You can't reliably use KVO to observe changes.
Nikolai Ruhe
  • 81,520
  • 17
  • 180
  • 200