iOS on resume

Hello, I need a view in my app to refresh everytime the app comes back to the foreground. The code below is working perfectly with Android but nothing happens on iOS.

$ionicPlatform.on('resume', function() {
    if($state.current.name == "app.listar_aprovacoes"){
      // code to refresh scope and view.
    };
  });

I also tried the following and it also doesn’t work with iOS:

document.addEventListener("resume", function() {
       var alertPopup = $ionicPopup.alert({
        title: 'Foo',
        template: 'Bar'
      });
    }, false);

So could you help me out with a solution to this problem?

Maybe try wrapping inside of the Ionic ready method?

$ionicPlatform.ready(function(){
    
  });

As @macfam suggests, check that the $ionicPlatform.on() call is inside $ionicPlatform.ready().

That is the way I have it set up in a few apps and works reliably across iOS and Android.

I was using platform update ios, I did a platform remove then added it again and it worked.