Mathew Jenkinson
Mathew Jenkinson

Reputation: 854

ViewController not refreshing when app launches if view is last one open

Apologies for the weird headline, can't think of a better way to describe it.

I'm building my app and have managed to get push notifications to work (Yay!). If I send a push notification to the phone and tap the notification the function didReceiveRemoteNotification: in AppDelegate gets called and works as expected.

If I ignore the notification and load the app as per normally, the UITableView page doesn't refresh and I have to move off the view and then back to get viewDidAppear to refresh the view.

How do I get the app / view to refresh the page when the user navigates back to the app?

Upvotes: 0

Views: 66

Answers (1)

William Hu
William Hu

Reputation: 16159

Have you tried to get the tableView to reloadData from applicationDidBecomeActive or post a notification to reload your tableview from this method like below?

func applicationDidBecomeActive(application: UIApplication) {
     yourVC.tableView.reloadData()
}

Upvotes: 1

Related Questions