屏幕锁定后,Capacitor Ios 应用程序在 Ios 上冻结
我正在编写一个跨平台应用程序(Win / IOS / Web),并在 IOS 应用程序中面临一些奇怪的冻结(IOS 版本 15.3.1 - 也发生在较低版本上)。当我关闭应用程序,将其放置约 5 秒,然后重新打开时,问题就出现了。然而,这些冻结只是偶尔出现,应用程序会在一段时间(10 秒到 2 分钟)后恢复。应用程序恢复后,它会继续运行,就像什么都没发生一样。
如果我在 Xcode 中调试应用程序并触摸冻结的应用程序用户界面,我会得到以下控制台输出: App[449:19368][IPC] Connection::waitForSyncReply: Timed-out while waiting for Reply for WebPage_touchEventSync from process 451 , id=39
不幸的是这个错误在调试过程中对我没有多大帮助。因此,我开始取消注释应用程序的以下部分,以识别有问题的部分(没有成功)
- SignalR 连接(如果连接在连接期间终止等)
- 获取数据(如果应用程序在获取数据时被挂起)
- 手表:
DeviceOrientation.watchHeading().subscribe(...)
Geolocation.watchPosition(...)
似乎禁用手表、获取和 SignalR 连接以某种方式降低了应用程序从后台运行后冻结的可能性。不幸的是,该应用程序仍然有时会卡住。
有人知道可能是什么问题吗?
我目前使用以下package.json(但其中一些在IOS构建中没有使用):
"dependencies": {
"@babel/core": "^7.13.14",
"@capacitor-community/electron": "^3.0.0-rc.6",
"@capacitor-community/http": "^1.0.0",
"@capacitor/app": "^1.0.5",
"@capacitor/browser": "^1.0.5",
"@capacitor/core": "^3.2.5",
"@capacitor/device": "^1.0.5",
"@capacitor/filesystem": "^1.0.5",
"@capacitor/geolocation": "^1.1.2",
"@capacitor/ios": "^3.2.5",
"@capacitor/network": "^1.0.5",
"@capacitor/push-notifications": "^1.0.6",
"@capacitor/share": "^1.0.6",
"@capacitor/splash-screen": "^1.1.5",
"@craco/craco": "^6.0.0",
"@ionic-native/device-orientation": "^5.36.0",
"@ionic-native/file-opener": "^5.34.0",
"@ionic-native/screen-orientation": "^5.36.0",
"@ionic/pwa-elements": "^3.0.2",
"@material-ui/core": "^4.11.0",
"@material-ui/icons": "^4.9.1",
"@material-ui/lab": "^4.0.0-alpha.60",
"@microsoft/signalr": "^3.1.6",
"@reduxjs/toolkit": "^1.4.0",
"axios": "^0.21.1",
"axios-retry": "^3.2.0",
"canvas": "^2.6.1",
"capacitor-secure-storage-plugin": "^0.6.2",
"cordova-plugin-device-orientation": "^2.0.1",
"cordova-plugin-file-opener2": "^3.0.5",
"cordova-plugin-screen-orientation": "^3.0.2",
"fibers": "^5.0.0",
"i18next": "^19.6.2",
"i18next-http-backend": "^1.0.21",
"ionic-appauth": "^0.7.4",
"node-sass": "^5.0.0",
"notistack": "^1.0.5",
"ol": "^6.3.1",
"proj4": "^2.6.3",
"react": "^17.0.1",
"react-dnd": "^14.0.2",
"react-dnd-html5-backend": "^14.0.0",
"react-dnd-touch-backend": "^14.0.0",
"react-dom": "^17.0.1",
"react-file-viewer": "^1.2.1",
"react-i18next": "^11.7.0",
"react-redux": "^7.2.0",
"react-router": "^5.2.0",
"react-router-dom": "^5.2.0",
"react-scripts": "4.0.3",
"react-webcam": "^6.0.0",
"redux": "^4.0.5",
"sass": "^1.32.8",
"type-fest": "^0.13.1",
"uuid": "^8.3.1"
}
}
I'm writing a cross-plattform application (Win / IOS / Web) and facing some strange freezes in the IOS application (IOS version 15.3.1 - also occured on lower versions). The problem arises when I close the app, keep it laying for around 5 seconds and then reopen it. However these freezes do only occasionally appear and the app manages after some time, between 10 seconds and 2 minutes, to recover. After the app has recovered it continues running as if nothing happend.
If I debug the app in Xcode and touch the frozen app user interface I get the following console output: App[449:19368][IPC] Connection::waitForSyncReply: Timed-out while waiting for reply for WebPage_touchEventSync from process 451, id=39
Unfortunately this error is not helping me a lot in the debugging process. So I started to uncomment the following parts of the application to identify the problematic part (without succes)
- SignalR connection (if the connection was terminated during the connection etc.)
- Fetching of data (if the app is getting suspended while fetching data)
- Watches:
DeviceOrientation.watchHeading().subscribe(...)
Geolocation.watchPosition(...)
It seems like disabling the watches, fetching and the SignalR connection somehow reduces the possibility to freeze the app after coming from the background. Unfortunately the app still gets some times stuck.
Is anybody having an idea what could be the Problem?
I currently use the following package.json (but some of them are not used in the IOS build):
"dependencies": {
"@babel/core": "^7.13.14",
"@capacitor-community/electron": "^3.0.0-rc.6",
"@capacitor-community/http": "^1.0.0",
"@capacitor/app": "^1.0.5",
"@capacitor/browser": "^1.0.5",
"@capacitor/core": "^3.2.5",
"@capacitor/device": "^1.0.5",
"@capacitor/filesystem": "^1.0.5",
"@capacitor/geolocation": "^1.1.2",
"@capacitor/ios": "^3.2.5",
"@capacitor/network": "^1.0.5",
"@capacitor/push-notifications": "^1.0.6",
"@capacitor/share": "^1.0.6",
"@capacitor/splash-screen": "^1.1.5",
"@craco/craco": "^6.0.0",
"@ionic-native/device-orientation": "^5.36.0",
"@ionic-native/file-opener": "^5.34.0",
"@ionic-native/screen-orientation": "^5.36.0",
"@ionic/pwa-elements": "^3.0.2",
"@material-ui/core": "^4.11.0",
"@material-ui/icons": "^4.9.1",
"@material-ui/lab": "^4.0.0-alpha.60",
"@microsoft/signalr": "^3.1.6",
"@reduxjs/toolkit": "^1.4.0",
"axios": "^0.21.1",
"axios-retry": "^3.2.0",
"canvas": "^2.6.1",
"capacitor-secure-storage-plugin": "^0.6.2",
"cordova-plugin-device-orientation": "^2.0.1",
"cordova-plugin-file-opener2": "^3.0.5",
"cordova-plugin-screen-orientation": "^3.0.2",
"fibers": "^5.0.0",
"i18next": "^19.6.2",
"i18next-http-backend": "^1.0.21",
"ionic-appauth": "^0.7.4",
"node-sass": "^5.0.0",
"notistack": "^1.0.5",
"ol": "^6.3.1",
"proj4": "^2.6.3",
"react": "^17.0.1",
"react-dnd": "^14.0.2",
"react-dnd-html5-backend": "^14.0.0",
"react-dnd-touch-backend": "^14.0.0",
"react-dom": "^17.0.1",
"react-file-viewer": "^1.2.1",
"react-i18next": "^11.7.0",
"react-redux": "^7.2.0",
"react-router": "^5.2.0",
"react-router-dom": "^5.2.0",
"react-scripts": "4.0.3",
"react-webcam": "^6.0.0",
"redux": "^4.0.5",
"sass": "^1.32.8",
"type-fest": "^0.13.1",
"uuid": "^8.3.1"
}
}
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我在我的应用程序中遇到了类似的问题(HU 提醒)...
我能够通过删除“@ionic-native/background-mode”(未使用)并查询后台模式(如果(在我的情况下与数据库的连接)仍然存在)来修复它...... ts)
希望我能帮忙一点
i had a similar problem in my app (HU Reminder)...
I was able to fix it by deleting '@ionic-native/background-mode' (not in use) and querying for the background mode if (in my case the connection to the DB) still exists... (app.component.ts)
hope I could help a little