title: iPhone refresh a view from another class
body: <p>I want to be able to refresh a view from another class, but nothing I have tried is working. My application is a tabbed application with several tabs set up. I have a method called refresh in my ViewController1 class that looks like this</p>
  
  <pre><code>-(void)TestMe{
  
  
       NSString *filePath = [[NSBundle mainBundle] pathForResource:@"widgjson" ofType:@"json"];  
       NSData *myData = [NSData dataWithContentsOfFile:filePath];  
  
       NSString *responseString = [[NSString alloc] initWithData:myData encoding:NSUTF8StringEncoding];
  
       NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
       NSString *docDir = [paths objectAtIndex: 0];
       NSString *docFile = [docDir stringByAppendingPathComponent: @"json.txt"];
       [responseString writeToFile:docFile atomically:NO encoding:NSUTF8StringEncoding error:Nil];
  
       [self loadView];
       [self viewDidLoad];
  }
  </code></pre>
  
  <p>This works fine. When the application first loads up, it loads a different json, then when I click this button it loads a new JSON and then updates the view. This is just temporary to test out refreshing. However if I try to call this method from another class, or from the AppDelegates ApplicationDidEnterForeground methods, nothing happens. I tried calling it like this </p>
  
  <pre><code> -(void)TestMe{
  
  
      ViewController1 *vc = [[ViewController1 alloc] init];
  
  
      NSString *filePath = [[NSBundle mainBundle] pathForResource:@"widgjson" ofType:@"json"];  
      NSData *myData = [NSData dataWithContentsOfFile:filePath];  
  
      NSString *responseString = [[NSString alloc] initWithData:myData encoding:NSUTF8StringEncoding];
  
      NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
      NSString *docDir = [paths objectAtIndex: 0];
      NSString *docFile = [docDir stringByAppendingPathComponent: @"json.txt"];
      [responseString writeToFile:docFile atomically:NO encoding:NSUTF8StringEncoding error:Nil];
  
      [vc loadView];
      [vc viewDidLoad];
  
  }
  </code></pre>
  
  <p>So why does this method not work from any other classes. All I want to is to be able to refresh a view from another class or when the application loads up, but just can't seem to find anything that works.</p>
  
  <p>Would be very grateful if someone could point me in right direction!</p>
  
  <p>EDIT: UPDATING TO CLARIFY</p>
  
  <p>Okay, what I have done for the time being which I don't like is put this</p>
  
  <pre><code>exit(0);
  </code></pre>
  
  <p>Inside AppDelegates ApplicationDidEnterBackground. This works to an extent, but is not an ideal solution.</p>
  
  <p>What I would like to have happen is that when application is opened again, the AppDelegate gets run again which sets up the tabs. The JSON pulled from the server can affect the order of the tabs which is why I need the AppDelegates ApplicationDidFinishLaunching method to reload itself again. </p>
  
  <p>Also I would like to know can I do this from another class in the application. The first time my application is loaded it asks for the users phone number, which is sent to the server which then generates an PIN. After this is done, then I want the AppDelegate method to load up and begin setting up the tabs and the order etc.</p>