Post

Replies

Boosts

Views

Activity

What happens after BGContinuedProcessingTask "expires"?
If I create a BGContinuedProcessingTaskRequest, register it, and then "do work" within it appropriately reporting progress, and before my task has finished doing all the work it had to do, its expirationHandler triggers... does the task later try again? Or does it lose the execution opportunity until the app is next re-launched to the foreground? In my testing, I never saw my task execute again once expired (which suggests the latter?). I was able to easily force this expiry by starting my task, backgrounding my app, then launching the iOS Camera App. My example is just using test code inspired from https://developer.apple.com/documentation/backgroundtasks/performing-long-running-tasks-on-ios-and-ipados let request = BGContinuedProcessingTaskRequest(identifier: taskIdentifier, title: "Video Upload", subtitle: "Starting Upload") request.strategy = .queue BGTaskScheduler.shared.register(forTaskWithIdentifier: taskIdentifier, using: nil) { task in guard let task = task as? BGContinuedProcessingTask else { return } print("i am a good task") var wasExpired = false task.expirationHandler = { wasExpired = true } let progress = task.progress progress.totalUnitCount = 100 while !progress.isFinished && !wasExpired { progress.completedUnitCount += 1 let formattedProgress = String(format: "%.2f", progress.fractionCompleted * 100) task.updateTitle(task.title, subtitle: "Completed \(formattedProgress)%") sleep(1) } if progress.isFinished { print ("i was a good task") task.setTaskCompleted(success: true) } else { print("i was not a good task") task.setTaskCompleted(success: false) } } try? BGTaskScheduler.shared.submit(request) Apologies if this is clearly stated somewhere and I'm missing it.
1
0
66
Nov ’25
Prevent compression of video when uploading via mobile Safari?
We provide a mechanism for a user to upload video files via mobile Safari, using a standard HTML file input, eg: <input type="file" multiple> As per a StackOverflow answer from a few years back, we've been including the multiple attribute, which worked around whatever was compressing the video and allowed it to be uploaded in original format. This no longer works, and the video is compressed as a part of this upload workflow. We've also noticed this is specific to the Photo Library -- if the user were to copy the video over to Files, and then upload it via the "browse" prompt (instead of Photo Library) it uploads as is without compressing. Is there anything else we can do to prevent this compression of video prior to upload?
2
2
1.2k
Jun ’23