views:

47

answers:

0

hi there,

in my application I need the wi-fi set to deactive. so when the app starts I verify the status and call the corresponding screen telling the user to put off the wi-fi. in ios4 the user may change to the settings without leaving the application. I yet included the

NSNotificationCenter *center = [NSNotificationCenter defaultCenter];
[center addObserver:self
           selector:@selector(defaultsChanged:)  
               name:NSUserDefaultsDidChangeNotification
             object:nil];

and the regarding method, as found here in stackoverflow. But this method isnt called when I change the wi-fi settings. have I done something wrong? or doesnt this observer listen to the wi-fi settings? is there another way?

just for completion, here is the methos that should be called on settings changes

- (void)defaultsChanged:(NSNotification *)notification {
NSLog(@"something changed");

}

by the way, I tried to do so with the language settings, but on change the app crashed and the iPhone s display turned to black for two seconds, telling me that its adjusting the languagesettings. then turned back to the home screen and I had to start the app again. well, thats not the issue with the wi-fi, but as I read that the mentioned observer listenes to the language settings changes, I am just wondering if the whole type of implementing the method might be wrong!!

thanks!!

related questions