Open amruth-movano opened 1 month ago
@amruth-movano Thanks for submitting the issue. To help us reproduce the issue and investigate further, can you provide a sample app or sample code that demonstrates how you're executing the upload?
@phantumcode
We have create one wrapper class -
import Amplify
import AWSS3StoragePlugin
import Foundation
import Resolver
protocol RemoteFileStoragable {
func store(localFile: URL, remoteName: String) async throws -> String
}
final class AmplifyFileStorage: RemoteFileStoragable {
private let storage: StorageCategoryBehavior
@Injected private var eventTracker: TelemetryTracker
init(_ storage: StorageCategoryBehavior = Amplify.Storage) {
self.storage = storage
}
func store(localFile fileUrl: URL, remoteName: String) async throws -> String {
let uploadTask = storage.uploadFile(
key: remoteName,
local: fileUrl,
options: nil
)
for await progress in await uploadTask.progress {
let percentage = Int(round(progress.fractionCompleted * 100))
eventTracker.track(event: .logOnly(message: "[AmplifyFileStorage] - Upload Progress (\(fileUrl.lastPathComponent)): \(percentage)%"))
}
let result = try await uploadTask.value
return result
}
}
And in another class we directly use the function to upload -
// Declaration -
@Injected private var remoteFileStorage: RemoteFileStoragable
// Use
let result = try await remoteFileStorage.store(localFile: filePath, remoteName: "\(parentFolderName)/\(userId)/\(filename).zip")
@amruth-movano Thanks for providing the sample code, we'll take a look.
@amruth-movano Can you provide details on how your app has been configured for different background modes?
Describe the bug
Hi Team, We have application which connection with BLE device and for each min it syncs data and as soon as sync completes it uploads the file to s3 for that particular sync.
So we are observing failure in files when app is in background overnight which is causing UI to hang when user come to foreground in the morning.
Please see logs attached
Steps To Reproduce
Expected behavior
All File should get upload
Amplify Framework Version
2.39.0
Amplify Categories
Storage
Dependency manager
Swift PM
Swift version
5.9.2
CLI version
12.11.1
Xcode version
15.2
Relevant log output
Is this a regression?
Yes
Regression additional context
No response
Platforms
iOS
OS Version
iOS 17.5.1
Device
iPhone 14 Pro
Specific to simulators
No response
Additional context
No response