Ionic 7 App stop working on iOS after a while

I have an Ionic 7 App . Main screen gets info about news,events from an API every time is started, using local cache.

On Android it works well, but on iPhone 12 or higher, it stops working SOMETIMES after restarting: menu disappears, blank screen… it seems all data is lost. Sometimes works for several days, sometimes stops working in two hours…

Any ideas?

{
...
  "private": true,
  "dependencies": {
    "@angular/animations": "^17.0.2",
    "@angular/cdk": "^17.3.2",
    "@angular/common": "^17.0.2",
    "@angular/compiler": "^17.0.2",
    "@angular/core": "^17.0.2",
    "@angular/forms": "^17.0.2",
    "@angular/platform-browser": "^17.0.2",
    "@angular/platform-browser-dynamic": "^17.0.2",
    "@angular/router": "^17.0.2",
    "@awesome-cordova-plugins/app-version": "^6.6.0",
    "@awesome-cordova-plugins/badge": "^6.6.0",
    "@awesome-cordova-plugins/barcode-scanner": "^6.6.0",
    "@awesome-cordova-plugins/camera": "^6.6.0",
    "@awesome-cordova-plugins/file": "^6.6.0",
    "@awesome-cordova-plugins/file-transfer": "^6.6.0",
    "@awesome-cordova-plugins/geolocation": "^6.6.0",
    "@awesome-cordova-plugins/insomnia": "^6.6.0",
    "@awesome-cordova-plugins/launch-navigator": "^6.6.0",
    "@awesome-cordova-plugins/photo-viewer": "^6.6.0",
    "@awesome-cordova-plugins/social-sharing": "^6.6.0",
    "@awesome-cordova-plugins/splash-screen": "^6.6.0",
    "@awesome-cordova-plugins/sqlite": "^6.6.0",
    "@awesome-cordova-plugins/sqlite-porter": "^6.6.0",
    "@capacitor/android": "^5.7.4",
    "@capacitor/app": "^5.0.7",
    "@capacitor/camera": "^5.0.9",
    "@capacitor/core": "^5.7.4",
    "@capacitor/device": "^5.0.7",
    "@capacitor/haptics": "^5.0.7",
    "@capacitor/ios": "^5.7.4",
    "@capacitor/keyboard": "^5.0.8",
    "@capacitor/network": "^5.0.7",
    "@capacitor/preferences": "^5.0.7",
    "@capacitor/splash-screen": "^5.0.7",
    "@capacitor/status-bar": "^5.0.7",
    "@ionic/angular": "^7.0.0",
    "@ionic/storage-angular": "^4.0.0",
    "@techiediaries/ngx-qrcode": "^9.1.0",
    "angularx-qrcode": "^17.0.0",
    "com-sarriaroman-photoviewer": "^1.3.0",
    "cordova-plugin-actionsheet": "^2.3.3",
    "cordova-plugin-badge": "^0.8.9",
    "cordova-plugin-camera": "^7.0.0",
    "cordova-plugin-dialog": "^0.0.1",
    "cordova-plugin-dialogs": "^2.0.2",
    "cordova-plugin-file": "^8.0.1",
    "cordova-plugin-file-transfer": "^2.0.0",
    "cordova-plugin-geolocation": "^5.0.0",
    "cordova-plugin-insomnia": "^4.3.0",
    "cordova-plugin-transfer": "^1.0.8",
    "cordova-plugin-x-socialsharing": "^6.0.4",
    "cordova-sqlite-storage": "^6.1.0",
    "es6-promise-plugin": "^4.2.2",
    "ionic-cache": "^6.0.3",
    "ionicons": "^7.0.0",
    "ngx-ionic-image-viewer": "^0.7.5",
    "onesignal-cordova-plugin": "^3.3.2",
    "rxjs": "~7.8.0",
    "swiper": "^11.1.0",
    "tslib": "^2.3.0",
    "uk.co.workingedge.cordova.plugin.sqliteporter": "^1.1.2",
    "uk.co.workingedge.phonegap.plugin.launchnavigator": "^5.0.6",
    "zone.js": "^0.14.4"
  },
...
}

You are going to have to provide more details so someone can help you. You mention “local cache”. That could be several different things. What are you using and what does your code look like.

1 Like

I think is important to say that App is working perfectly on Android, and former version with Ionic 5 worked fine also in iOS. Same code.

When the app starts everything is ok. The problem appears sometimes when you switch to another App (or go iOs Main Screen) and come back after a while to my app: Side menu and content screen are blank. You can see an example here:

With local cache I mean that I’m using ionic-cache for most of my requests to the API, using code like this:

  get(action: string, params: string = '', ttl: number = -1) {
    if (ttl == -1) ttl = this.ttl;
    if (ttl == 0)
      return this.cache.loadFromDelayedObservable(
        action + params,
        this.http.get(API.url + '/' + action + '?' + params),
        this.cachekey,
        0,
        'all'
      );
    else
      return this.cache.loadFromObservable(
        action + params,
        this.http.get(API.url + '/' + action + '?' + params),
        this.cachekey,
        ttl
      );

I tried with an Iphone 13 emulator and everything is ok.