ios - call method when Variable changes value -


i have bool defined in app delegate.m, , in view controller.h have

extern bool usinginternet; 

and want call method anytime value changes, trying

[usinginternet addobserver:self forkeypath:@"mydata" options:0 context:@"data"]; 

but compile error, bad receiver type bool how can call method every time bool changes value?

thanks

[self addobserver:self forkeypath:@"usinginternet" options:0 context:nil]; 

and result from

- (void)observevalueforkeypath:(nsstring *)keypath ofobject:(id)object change:(nsdictionary *)change context:(void *)context {     nslog(@"%@, %@, %@", keypath, @(usinginternet), change); } 

Comments

Popular posts from this blog

toolbar - How to add link to user registration inside toobar in admin joomla 3 custom component -

linux - disk space limitation when creating war file -