QField icon indicating copy to clipboard operation
QField copied to clipboard

Frequent QFieldCloud logouts on iPhone (iOS 18.5)

Open AlexMccd opened this issue 6 months ago • 6 comments

What is the bug or the crash? What were your expectations and what actually happened?

Summary

Since recently, I’ve been frequently logged out of QFieldCloud when using the QField iOS app. Each time I want to push or pull changes, I’m required to re-enter my login credentials. This occurs systematically after a short period (about 10–15 minutes), even if the app is left open in the foreground.

This behavior is new — I didn’t experience this before (previous weeks/months, same project, same phone). The logout seems to happen silently in the background, with no warning.


Environment

  • Device: iPhone SE 2020
  • iOS version: 18.5
  • QField app version: latest available from App Store (as of June 2025)
  • QGIS version: 3.36.6 (on Windows)
  • QFieldCloud account: active, project already synced and functional

Steps to reproduce the issue

  1. Open QField on iOS
  2. Open a project connected to QFieldCloud
  3. Wait ~10–15 minutes (without using the app actively, or after small edits)
  4. Try to sync (push/pull)
  5. The app prompts for QFieldCloud credentials again

Version

3.36.6

Operating system name

Android

Operating system version

iPhone SE 2020 - iOS version: 18.5

Reinstall QField

  • [x] I have a fresh install of the latest QField version, but the problem persists.
  • [x] Problem can be reliably reproduced, doesn't happen randomly.
  • [x] Problem happens with all files and projects, not only some files or projects.

Additional context

Expected Behavior

Stay logged in to QFieldCloud until I explicitly log out, or at least throughout a full work session.


Actual Behavior

QFieldCloud session expires after ~10–15 minutes, requiring re-login for every sync operation.


Notes

  • The network connection is stable (tested on Wi-Fi and 4G)
  • The project is small and was working fine before
  • This issue does not occur on desktop or Android (according to my colleagues)
  • Might be related to session timeout or token expiry on iOS?

Suggestions or workaround?

Is there a known session timeout in QFieldCloud for iOS? Could this be related to new iOS background restrictions, or a bug in the session management?

Thanks in advance for your help, and let me know if I can provide logs or test additional scenarios.

AlexMccd avatar Jun 25 '25 07:06 AlexMccd

Hi,

I've experienced the same thing. However, my issue was linked with the fact that I tried to share a common account with one of my collaborators. I didn't to have to create too many accounts on my cloud instance. Every time I logged in, QFieldCloud logged him out (and vice versa).

Of course, if you're using QField alone this isn't the issue.

Hope this helps, have a nice day !

AntoElCrackito avatar Jun 27 '25 06:06 AntoElCrackito

Thanks for your reply!

I had already encountered the issue you mentioned in the past, when using the same QFieldCloud account on two devices — and indeed, it caused disconnections when switching between them.

However, this is not the case here: since the issue started, I’ve only been using QFieldCloud from a single device, with no other active sessions elsewhere.

So it seems to be a different issue, likely unrelated to shared sessions.

Thanks again for your help!

AlexMccd avatar Jun 27 '25 09:06 AlexMccd

@AlexMccd thanks for highlighting this! As of step "3) Wait ~10–15 minutes (without using the app actively, or after small edits)", do you keep the app in the foreground or it also sometimes goes to the background?

Can you try with keeping the app only in the foreground if the issue persists. Also, just to confirm, you are using the service from app.qfield.cloud?

suricactus avatar Jun 27 '25 13:06 suricactus

I tried to reproduce this, but was unable to:

QField 3.6.6 on iOS 18.5, iPhone 12 mini, using an existing project onapp.qfield.cloud. Signed in once (using username and password), and the authentication session stayed valid for at least 3 hours until I stopped testing. Long periods of inactivity of at least 30min. It also survived backgrounding the app, and even closing and re-opening it.

Neither syncing nor refreshing the project list ever triggered a re-authentication prompt.

lukasgraf avatar Jun 30 '25 11:06 lukasgraf

Thanks a lot for your message and for the suggested test!

I ran the test as you described, and here's what I found:

✅ When I keep the QField app open in the foreground (i.e., screen on, no app switching), or only briefly switch to 1 or 2 other apps, I do not get logged out — even after 30 minutes.

❌ However, if I leave the app in the background for a longer time, or switch between several apps (e.g., messaging, browser, notes), I do get logged out and need to re-enter my QFieldCloud credentials when trying to sync again.

So the issue clearly seems related to how iOS handles background activity and session persistence in the QFieldCloud authentication process.

Would it be technically feasible to implement a silent token refresh, or a way to maintain the session for longer even when the app is backgrounded for a short time? That would greatly improve the fluidity of field use, especially when referencing other apps during a survey.

Thanks again for your help and the great work on QField!


Merci beaucoup pour votre message et pour la proposition de test !

J’ai effectué le test comme suggéré, et voici mes conclusions :

✅ Lorsque je garde l’application QField ouverte au premier plan (écran actif, pas de changement d’application), ou que je change brièvement vers 1 ou 2 autres applis, je ne suis pas déconnecté, même après 30 minutes.

❌ En revanche, si je laisse QField en arrière-plan trop longtemps ou que je change d’appli plusieurs fois (ex. : messagerie, navigateur, notes), alors je suis bien déconnecté et je dois ressaisir mes identifiants QFieldCloud à la synchronisation.

Il semble donc que le problème soit lié à la gestion du passage en arrière-plan par iOS et à la non-persistence de la session côté QFieldCloud.

Est-ce qu’il serait techniquement envisageable d’ajouter un rafraîchissement silencieux du jeton ou un système pour maintenir la session active un peu plus longtemps ? Cela améliorerait fortement l’usage en mobilité, surtout lorsqu’on utilise d’autres applis en parallèle.

Encore merci pour votre aide et bravo pour votre excellent travail sur QField !

AlexMccd avatar Jul 01 '25 10:07 AlexMccd

@suricactus Thanks a lot for trying to reproduce the issue — and for sharing the details of your test!

It’s very helpful to know that you didn’t encounter the problem, even with backgrounding or closing the app.

This suggests the issue may be device- or context-specific. I'd be happy to compare variables to help narrow it down. Here are some details on my side:

  • Device: iPhone SE 2020 (64 GB, ~80% full)
  • iOS version: 18.5
  • QField version: 3.6.6 (App Store)
  • QGIS version: 3.36.6 (Windows)
  • QFieldCloud: using app.qfield.cloud
  • Session duration before logout: typically 10–15 minutes
  • Usage pattern: often switching between several apps (Notes, Safari, Mail, Photos...), sometimes leaving QField in background for 5–10 minutes
  • Battery mode: Low Power Mode sometimes ON (but not always during tests)

Could it be that session persistence depends on RAM usage, device performance, or some iOS background process being killed... Let me know if you’d like me to test specific settings or run a session with logs enabled. I’d be happy to help debug this further!

Thank you again !!

AlexMccd avatar Jul 01 '25 10:07 AlexMccd