First store your newJson in NSUserDefaults
as seen below
if (![NewJson isEqualToString:OldJson])
{
completionHandler(UIBackgroundFetchResultNewData);
NSLog(@"New Data : %@",NewJson);
NSUserDefaults* defaults = [NSUserDefaults standardUserDefaults];
[defaults setObject:NewJson forKey:@"newJson"];
}
Second in your View Controller add this in the ViewDidLoad
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(refresh:) name: UIApplicationWillEnterForegroundNotification object:nil];
Add this to your viewWillAppear
-(void)viewWillAppear:(BOOL)animated{
[self loadData];
}
Create the loadData
- (void)loadData {
// contains information the ViewController makes use of
NSUserDefaults* defaults = [NSUserDefaults standardUserDefaults];
textView.text = [defaults objectForKey:@"newJson"];
}
Finally add your action
-(IBAction)refresh:(id) sender {
NSLog(@"I ran");
[self loadData];
}
I tested this and it works.