Problem with iOS in the background after time

Ionic iOS Selecting the background application after a while, it only shows the splash screen and the application does not continue.

Installing the Ionic application in iOS 11.3 it works correctly after pressing the home menu and the application goes to background after approximately 3 hours Select the application then only the splash screen is show and don’t continue with the application. I check in safari the navigation and it shows an about:blank, there is nothing in resources and in the console prints

exception nativeEvalAndFetch: ReferenceError: Can not find variable: cordova.

  • iOS: 11.3.1
  • engine name = “ios” spec = “4.4.0”
  • @ ionic / cli-utils: 1.19.2
  • ionic (Ionic CLI): 3.20.0 global packages:
  • Cordova (Cordova CLI): 8.0.0 local packages:
  • @ ionic / app-scripts: 3.1.6
  • Cordova Platforms: android 6.4.0
  • Ionic Framework: ionic-angular 3.9.2 System:
  • Node: v6.11.5
  • npm: 5.6.0

I’ve currently checked in the console and it shows the following: exception nativeEvalAndFetch : ReferenceError: Can’t find variable: cordova global code about:blank 1:127 global code script element 1:1:127 try { cordova.require(‘cordova/exec’).nativeEvalAndFetch(function() { cordova.fireDocumentEvent(‘active’); }) } catch (e) { console.log('exception nativeEvalAndFetch : ’ + e); }; Looking for this code in xcode I find that it is in CDVCommandDelegateImpl.m but I could not solve it yet

Anyone else have this problem?

Cheking this post: https://www.outsystems.com/forums/discussion/35329/post-ios-11-3-mobile-app-freeze-crash-on-resume-after-sleep-silk-ui/

I tested it in iOS version 10.3.3 and the function of the application is correct, so there is an error in the new version 11.3 and also in the 11.4.

1 Like

I have the same issue, good to know, thanks for sharing

Same issue, any solution from ionic?

Hey Guys,

I just want to ask if somebody fixed this issue. With iOS 11.4.1 the bug still exists.
If not, do you have any workaround?

Mike

Ionic:

   ionic (Ionic CLI)  : 4.1.0 (/Users/mike/.nvm/versions/node/v10.7.0/lib/node_modules/ionic)
   Ionic Framework    : ionic-angular 3.9.2
   @ionic/app-scripts : 3.1.11

Cordova:

   cordova (Cordova CLI) : 8.0.0
   Cordova Platforms     : android 7.1.1, ios 4.5.5
   Cordova Plugins       : cordova-plugin-ionic-keyboard 2.1.2, cordova-plugin-ionic-webview 1.2.1, (and 12 other plugins)

System:

   Android SDK Tools : 26.1.1
   ios-deploy        : 2.0.0
   NodeJS            : v10.7.0 (/Users/mike/.nvm/versions/node/v10.7.0/bin/node)
   npm               : 6.3.0
   OS                : macOS High Sierra
   Xcode             : Xcode 9.4.1 Build version 9F2000

Environment:

   ANDROID_HOME : /Users/mike/Library/Android/sdk

Im experiencing the same issue as well. Any body a solution yet?

Im on iOS 12.1

Ionic:

ionic (Ionic CLI) : 4.1.2 (/usr/local/lib/node_modules/ionic)
Ionic Framework : ionic-angular 3.9.2
@ionic/app-scripts : 3.1.11

Cordova:

cordova (Cordova CLI) : 7.1.0
Cordova Platforms : android 6.4.0, ios 4.5.5
Cordova Plugins : cordova-plugin-ionic-webview 1.2.1, (and 23 other plugins)

Hey @jeorgefabre! Indeed, I have a working solution.

The issue was fixed in a pullrequest in the cordova-ios repository (see https://github.com/apache/cordova-ios/pull/363/files). Nevertheless, there does not exist an update with this PR yet. Therefore, I decided to download the fixed file and after adding the ios platform, I replace the old CDVViewController.m on my own. For me this worked and my > 2000 user do not experience this issue anymore.

The path to the old file is platforms/ios/CordovaLib/Classes/Public/CDVViewController.m.

Remember to replace this file everytime after removing/adding the platform. I use for this (and other things) a shellscript to prepare my working directory before building.

I hope this will help you.

1 Like

@Mike1707

I’ve experienced the same issue. I’m still testing this solution and it looks the good one. The version 5.0.0 of cordova-ios includes this code automatically. We don’t know what is the cause of this problem but I think that with this solution it doesn’t matter anymore.

Thank you very much and an apologize for my english.

1 Like