bug: iOS UI freeze after return from background (After upgrade to capacitor 3)
See original GitHub issueBug Report
Capacitor Version
💊 Capacitor Doctor 💊
Latest Dependencies:
@capacitor/cli: 3.3.4 @capacitor/core: 3.3.4 @capacitor/android: 3.3.4 @capacitor/ios: 3.3.4
Installed Dependencies:
@capacitor/cli: 3.3.4 @capacitor/core: 3.3.4 @capacitor/android: 3.3.4 @capacitor/ios: 3.3.4
PASTE OUTPUT HERE
Platform(s)
iOS
Current Behavior
iOS UI freeze after returning from the background, while I try to navigate to other pages. (Happens randomly while returning from background) It would be fine if I’m staying on the same page by scrolling, opening modal or side menu. This issue happens after I upgrade to Ionic framework 6 and capacitor 3.
There’s totally no error from xcode / console log and it just freezes the UI. I did trace all errors by using sentry and it doesn’t have any records as well.
Expected Behavior
Before this, the Apps were working just fine.
Other Technical Details
npm --version
output:
8.3.0
node --version
output:
v16.13.0
pod --version
output (iOS issues only):
1.11.2
Ionic Info
output:
Ionic:
Ionic CLI : 6.18.1 Ionic Framework : @ionic/angular 6.0.1 @angular-devkit/build-angular : 13.1.2 @angular-devkit/schematics : 12.2.10 @angular/cli : 13.1.2 @ionic/angular-toolkit : 5.0.3
Capacitor:
Capacitor CLI : 3.3.4 @capacitor/android : 3.3.4 @capacitor/core : 3.3.4 @capacitor/ios : 3.3.4
Utility:
cordova-res : 0.15.4 native-run : 1.5.0
System:
NodeJS : v16.13.0 npm : 8.3.0 OS : macOS Monterey
Additional Context
Issue Analytics
- State:
- Created 2 years ago
- Reactions:1
- Comments:6 (2 by maintainers)
Top GitHub Comments
the release is on npm https://www.npmjs.com/package/@capacitor/ios
@jcesarmobile I think I’ve stumbled upon the same issue.
Today I’ve managed to get the issue while connected to USB with the debugger on:
It happens once in a while, on some iOS-devices only. Not older Device-type related, got it on a iPhone 12 of a co-worker today. On my iPhone 12 (same iOS-version) it never happened (yet).
We tried to find why this happened since a while (Capacitor 3 related or ionic related, I wasn’t sure). Found online something about webViewWebContentProcessDidTerminate, which was available in capacitor 2, which reloads the webview if crashed: https://github.com/ionic-team/capacitor/blob/260feebb78d67c431de7831548dfd4271ceb5079/ios/Capacitor/Capacitor/CAPBridgeViewController.swift#L346-L348
It was removed here (in v3): https://github.com/ionic-team/capacitor/commit/581d89cfd9581bec4e99808b810b3dab2741d4eb#diff-dd3e575ae0eaf8c928bf7f907d10f1bb769e01a2dc37093b0e0946b8515f9923L350
I’m not sure, but maybe it’s related. The old app reloaded the WebView when it crashed as a workaround, couldn’t find this webViewWebContentProcessDidTerminate method in the latest code.