I'm struggling with the following problem:
I'm using the method
(BOOL) Application: (UIApplication *) application openURL: (NSURL *) url sourceApplication: (NSString *) sourceApplication annotation: (id) annotation
Exile. So when I call myapp: // serverurl / url string url is set in an NSUSerDefaults key it still works fine but when I currently use my app In the settings view, where you can manually set this variable and I call the URL above for example from the mail-app, this variable sets the variable, but the related related text file is not updated. . Therefore, the old string is still written in the textfield but NSUSerDefaults has an update correctly.
I tried to work with the Notification Center, I forced the following method:
[[NSNotificationCenter defaultCenter] addObserver: Self selector: @selector (updateServerURLTextField) : UIApplicationWillEnterForegroundNotification object: zero]; - (zero) updateServerURLTextField {nslog ("updating server address label"); NSString * serverFullURL = [[NSUserDefaults Standard User Default] ObjectForrechy: wServerFullURLKey]; Self.serverURLTextField.text = serverFullUrl; }
The notification is removed, hence updateServerURLTextField but it is not updated. Do I accept some race conditions?
- (zero) ApplicationDidbackActive: (UIApplication *) Application
After the notification is removed, it is called. Maybe the GUI cant be updated before the app is active?
Has anyone got any indication?
You can not update the UI this way. All UI changes need to be made on the main thread. You might consider using:
Comments
Post a Comment