Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8644941
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T12:25:24+00:00 2026-06-12T12:25:24+00:00

In Settings.bundle , I have a text input with the identifier url_preference . Using

  • 0

In Settings.bundle, I have a text input with the identifier url_preference.

Using ViewController.h, ViewController.m, and my storyboards I have a UIWebView set up that displays a url from the Settings:

- (void) updateBrowser {   
    NSString *fullURL = [[NSUserDefaults standardUserDefaults] stringForKey:@"url_preference"];
    NSURL *url = [NSURL URLWithString:fullURL];
    NSURLRequest *requestObj = [NSURLRequest requestWithURL:url];
    [_EmbeddedBrowser loadRequest:requestObj];    
}

This works.

When the URL in the Settings is changed, however, the UIWebView does not update to reflect the new URL.

By disallowing the app to run in the background, the problem of not reflecting updated URLs is solved. However, a new problem arises: sessions are not preserved if the URL in Settings is left unchanged. UIWebView should only update if the url_preference is changed.

I’ve been attempting to use applicationWillEnterForeground in AppDelegate.m to force the UIWebView to reload, however I’m having trouble.

In the ViewController, I can run:

- (void)viewDidLoad {
     [self updateBrowser];
}

But it doesn’t update when I try to run the same thing in the App Delegate:

- (void)applicationWillEnterForeground:(UIApplication *)application
{

    ViewController *vc = [[ViewController alloc]init];
    [vc updateBrowser];
}

(I also included - (void) updateBrowser; in ViewController.h, and #import "ViewController.h" in AppDelegate.m

Thank you.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-12T12:25:25+00:00Added an answer on June 12, 2026 at 12:25 pm
    - (void)viewDidLoad
    {
        [self updateBrowser];
        [super viewDidLoad];
        NSNotificationCenter *center = [NSNotificationCenter defaultCenter];
        [center addObserver:self
                   selector:@selector(defaultsChanged:)
                       name:NSUserDefaultsDidChangeNotification
                     object:nil];
    }
    
    - (void)defaultsChanged:(NSNotification *)notification {
        [self updateBrowser];
    }
    
    - (void) updateBrowser {
    
        NSString *fullURL = [[NSUserDefaults standardUserDefaults] stringForKey:@"url_preference"];
        NSURL *url = [NSURL URLWithString:fullURL];
        NSURLRequest *requestObj = [NSURLRequest requestWithURL:url];
        [_EmbeddedBrowser loadRequest:requestObj];
    
    }
    

    Luckily, there is no need to use the AppDelegate for this type of situation. There is actually a notification that you listen for when the Default Settings change. You have to set up the ViewController as an observer and have a function execute every time the NSUserDefaultsDidChangeNotification is sent out. This notification will automatically occur every time the Default Settings for the app are changed in the settings. This way you don’t have to refresh every time the app comes to the foreground, only when the settings change.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have created a settings bundle with a single preference value, a text field
I have setup a settings bundle and can successfully pull data from that. I
I have settings.bundle in my application with a Root.plist that is localized correctly with
I have an iPhone application with a settings.bundle that handles various settings for my
I have created a Settings.bundle that came with a Root.plist file and a localization
I have noticed that some values in settings.bundle (Root.plist) do not allow you to
I have been trying to use the Settings.bundle as the store for options using
I have noticed that some applications add entries into the settings.bundle that simply represent
I have a settings bundle in my iPhone app, with the following PList: Type:
I'd like to have a settings bundle behavior similar to the iPhone WiFi settings.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.