iOS background upload not working if app is force-quit #2677

Closed
opened 2026-02-05 06:42:26 +03:00 by OVERLORD · 4 comments
Owner

Originally created by @gnojus on GitHub (Mar 25, 2024).

The bug

Background upload in ios only works if the immich app is not force-quit by the user.

The OS that Immich Server is running on

N/A

Version of Immich Server

v1.99.0

Version of Immich Mobile App

v1.99.0

Platform with the issue

  • Server
  • Web
  • Mobile

Your docker-compose.yml content

N/A

Your .env content

N/A

Reproduction steps

1. Force quit Immich (swipe up to close from multitasking UI)
2. Take a photo
3. Wait for it to be uploaded in background

The upload never happens (you may get a notification about a upload starting, but it never completes)

Additional information

No response

Originally created by @gnojus on GitHub (Mar 25, 2024). ### The bug Background upload in ios only works if the immich app is not force-quit by the user. ### The OS that Immich Server is running on N/A ### Version of Immich Server v1.99.0 ### Version of Immich Mobile App v1.99.0 ### Platform with the issue - [ ] Server - [ ] Web - [X] Mobile ### Your docker-compose.yml content ```YAML N/A ``` ### Your .env content ```Shell N/A ``` ### Reproduction steps ```bash 1. Force quit Immich (swipe up to close from multitasking UI) 2. Take a photo 3. Wait for it to be uploaded in background The upload never happens (you may get a notification about a upload starting, but it never completes) ``` ### Additional information _No response_
Author
Owner

@alextran1502 commented on GitHub (Mar 25, 2024):

The background task will only run if you put the app into the background, not force quit the entire app.

@alextran1502 commented on GitHub (Mar 25, 2024): The background task will only run if you put the app into the background, not force quit the entire app.
Author
Owner

@gnojus commented on GitHub (Mar 30, 2024):

Hi, thanks for your reply. To follow up:

  1. Maybe it would be nice to add a FAQ entry about this? I'm not sure what people expect in general when presented with background backup, but I personally thought it would work with the app closed completely.
  2. Can I ask why the limitation? Is it limited by current app implementation or by iOS scheduler? If the latter, I'm a bit surprised, because my testing has shown that iOS does launch the background tasks with the app force-quit: official immich iOS app get's around 1 BGProcessingTask a day (but fails to sync as per this issue). My custom build of immich that just sends sync notifications gets the same 1 BGProcessingTask, but for some reason also many BGAppRefreshTask every hour or so, not sure why the difference.
  3. If relying on the iOS scheduler for force-quit upload is not possible, may I suggest to add an action Peform backup to iOS shortcuts? The shortcuts automations work very reliably and would allow user to choose when to run (specific time daily, when closing camera app, etc)
@gnojus commented on GitHub (Mar 30, 2024): Hi, thanks for your reply. To follow up: 1. Maybe it would be nice to add a FAQ entry about this? I'm not sure what people expect in general when presented with _background backup_, but I personally thought it would work with the app closed completely. 2. Can I ask why the limitation? Is it limited by current app implementation or by iOS scheduler? If the latter, I'm a bit surprised, because my testing has shown that iOS _does_ launch the background tasks with the app force-quit: official immich iOS app get's around 1 `BGProcessingTask` a day (but fails to sync as per this issue). My custom build of immich that just sends sync notifications gets the same 1 `BGProcessingTask`, but for some reason also many `BGAppRefreshTask` every hour or so, not sure why the difference. 3. If relying on the iOS scheduler for force-quit upload is not possible, may I suggest to add an action `Peform backup` to iOS shortcuts? The shortcuts automations work very reliably and would allow user to choose when to run (specific time daily, when closing camera app, etc)
Author
Owner

@alextran1502 commented on GitHub (Mar 30, 2024):

@gnojus

  1. Yes, I agree, we receive quite many questions about this.
  2. The limitation is the way the iOS scheduler works. I am surprised that background tasks get scheduled when the app is not in the background. Perhaps I misunderstood how the mechanism should work.
  3. You seem to have more experience in iOS development; perhaps you can help us with this? We don't have a lot of experience in iOS dev so this would be really appreciated
@alextran1502 commented on GitHub (Mar 30, 2024): @gnojus 1. Yes, I agree, we receive quite many questions about this. 2. The limitation is the way the iOS scheduler works. I am surprised that background tasks get scheduled when the app is not in the background. Perhaps I misunderstood how the mechanism should work. 3. You seem to have more experience in iOS development; perhaps you can help us with this? We don't have a lot of experience in iOS dev so this would be really appreciated
Author
Owner

@gnojus commented on GitHub (Apr 4, 2024):

Apple themselves say that bg fetch should not work when force quit. In my current experience, iOS may launch the BGProcessingTask task daily, but only if the app was opened manually recently, so that's not very useful for the auto background upload without ever opening the app.

I'm don't really have much experience with iOS development, only some minor contributions to open source apps. I did try to add a shortcut/intent to the Runner xcode project, but my attempt ended with me getting a build error with dependency loop. I may give it another go, though.

@gnojus commented on GitHub (Apr 4, 2024): [Apple themselves](https://forums.developer.apple.com/forums/thread/666149) say that bg fetch should not work when force quit. In my current experience, iOS may launch the `BGProcessingTask` task daily, but only if the app was opened manually recently, so that's not very useful for the auto background upload without ever opening the app. I'm don't really have much experience with iOS development, only some minor contributions to open source apps. I did try to add a shortcut/intent to the `Runner` xcode project, but my attempt ended with me getting a build error with dependency loop. I may give it another go, though.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: immich-app/immich#2677