最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

Flutter app (only on iOS) loses internet connection after iPhone locks screen - Stack Overflow

programmeradmin2浏览0评论

Sometimes my Flutter application loses the internet connection when app is suspended for a long time. It mostly happens when the iPhone locks the screen automatically after inactivity. Then, when the iPhone is unlocked and the app resumed, every single request, either an API call or a firebase access, does not complete successfully. I'm reproducing this using a real iPhone 7. Looking into my app Crashlytics, it seems it happens in a different way in newer iPhones (after iPhone 12). In these new devices, after the internet connection lost, every firebase database request throws a firebase-database/permission-denied error. I've already talked to the Firebase Flutter support and they've confirmed it is a misinformation because it doesn't have anything really related to my databse rules.

Our best guess is that there's something wrong in my Flutter application set up that makes iPhone lose the connection to the internet after a long time suspended (which is the correct behavior), but it isn't able to retrieve this connection automatically (here's the problem).

I've already added UIBackgroundModes like this:

<key>UIBackgroundModes</key>
<array>
    <string>fetch</string>
    <string>processing</string>
    <string>remote-notification</string>
</array>
发布评论

评论列表(0)

  1. 暂无评论