You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
We should investigate the various ways our supported iOS versions notify an app that the session has completed, and ensure we provide clear documentation and necessary Amplify Storage APIs for re-launching an app when a transfer completes.
Just to circle back on this, I have figured out the solution.
1 - In terms of the code itself, you'll just drop in something to this effect into your AppDelegate.swift file. What makes it a bit non-obvious is that you're importing AWSS3 directly and there are no references to Amplify.
import Foundation
import UIKit
import AWSS3
import os.log
// Needed to handle completion of background sessions for file uploads
// If you're working on a new project with SwiftUI and iOS13+ you'll have to go out of your way to wire up `AppDelegate` through
// the @UIApplicationDelegateAdaptor property wrapper
class AppDelegate: NSObject, UIApplicationDelegate {
func application(_ application: UIApplication, handleEventsForBackgroundURLSession identifier: String, completionHandler: @escaping () -> Void) {
os_log("handleEventsForBackgroundUrlSession: %{public}@", log: OSLog.fileupload, type: .debug, identifier)
AWSS3TransferUtility.interceptApplication(application, handleEventsForBackgroundURLSession: identifier, completionHandler: completionHandler)
}
}
2 - Here's the part that was really at the root of most of my troubles: in iOS 13+, it's possible that your iOS Settings can be inadvertently configured so that iOS never resumes/relaunches your app, which can be incredibly confusing and send you on lots of wild goose chases if you don't already know about this. See https://developer.apple.com/forums/thread/124265?answerId=388440022#388440022
This was a fairly painful and confusing debugging process to get to to the bottom of this. Given how common a use case it is to upload large files, I hope this is helpful to someone else.
This issue is stale because it has been open for 14 days with no activity. Please, provide an update or it will be automatically closed in 7 days.
github-actionsbot
added
closing soon
This issue will be closed in 7 days unless further comments are made.
and removed
closing soon
This issue will be closed in 7 days unless further comments are made.
labels
Jun 19, 2021
In aws-amplify/docs#2699 (comment), @ptwobrussell noted that we do not provide documentation or an API for resuming an app when a background transfer completes.
We should investigate the various ways our supported iOS versions notify an app that the session has completed, and ensure we provide clear documentation and necessary Amplify Storage APIs for re-launching an app when a transfer completes.
Just to circle back on this, I have figured out the solution.
1 - In terms of the code itself, you'll just drop in something to this effect into your AppDelegate.swift file. What makes it a bit non-obvious is that you're importing
AWSS3
directly and there are no references to Amplify.2 - Here's the part that was really at the root of most of my troubles: in iOS 13+, it's possible that your iOS Settings can be inadvertently configured so that iOS never resumes/relaunches your app, which can be incredibly confusing and send you on lots of wild goose chases if you don't already know about this. See https://developer.apple.com/forums/thread/124265?answerId=388440022#388440022
This was a fairly painful and confusing debugging process to get to to the bottom of this. Given how common a use case it is to upload large files, I hope this is helpful to someone else.
Originally posted by @ptwobrussell in aws-amplify/docs#2699 (comment)
The text was updated successfully, but these errors were encountered: