Closed Aoi-Takahashi closed 1 day ago
This has been identified as a feature request. If this feature is important to you, we strongly encourage you to give a 👍 reaction on the request. This helps us prioritize new features most important to you. Thank you!
Hello @Aoi-Takahashi , App Extensions are currently not supported with Amplify. The error you're seeing is this one: https://developer.apple.com/documentation/foundation/1508628-url_loading_system_error_codes/nsurlerrorbackgroundsessionrequiressharedcontainer
We are marking this as a feature request and update this thread we have an update.
Hello @Aoi-Takahashi , App Extensions are currently not supported with Amplify. The error you're seeing is this one: https://developer.apple.com/documentation/foundation/1508628-url_loading_system_error_codes/nsurlerrorbackgroundsessionrequiressharedcontainer
We are marking this as a feature request and update this thread we have an update.
@thisisabhash Oh...I see. Actually, I had a inkling of this result (that Amplify does not support File Up/Down on the Share extension).... I understand that you are considering this as a feature request, but could you please tell us about the following?
Hello @Aoi-Takahashi You may want to look at this thread here - https://stackoverflow.com/questions/25438709/afnetworking-background-session-configuration-for-ios-8-extension
NSURLSession
expects the App Extension to share the same container identifier as the host app. Currently, it is not configurable while using Amplify Storage APIs.
However, you may work around this by using Escape Hatch.
https://docs.amplify.aws/lib/storage/escapehatch/q/platform/ios/
This will give you access to the S3Client
where you can use your custom URLSession
object with shared container identifier and call methods on the S3Client
directly.
Hello @Aoi-Takahashi You may want to look at this thread here - https://stackoverflow.com/questions/25438709/afnetworking-background-session-configuration-for-ios-8-extension
NSURLSession
expects the App Extension to share the same container identifier as the host app. Currently, it is not configurable while using Amplify Storage APIs. However, you may work around this by using Escape Hatch. https://docs.amplify.aws/lib/storage/escapehatch/q/platform/ios/This will give you access to the
S3Client
where you can use your customURLSession
object with shared container identifier and call methods on theS3Client
directly.
@thisisabhash @harsh62 I am currently working on a solution to this problem based on your response, but I can't think of a specific technique based on the URL you provided, I would like to know if there are any other specific tips or approaches to solving this problem: ....
This issue is now closed. Comments on closed issues are hard for our team to see. If you need more assistance, please open a new issue that references this one. If you wish to keep having a conversation with other community members under this issue feel free to do so.
Describe the bug
Hi!,Firstly, I would like to express my gratitude for this wonderful framework and all the advice from everyone.
Currently, we are developing a mobile app for both iOS and Android using React Native. To share PDFs with our app in development from external sources, we are considering using the iOS Share Extension to directly upload shared PDFs to our amplify S3 setup for mobile app use. However, when we execute
Amplify.Storage.uploadFile()
inside the ShareViewController UI'sdidSelectPost()
provided by the Share Extension, the errorError Domain=NSURLErrorDomain Code=-995 "(null)"
occurs. Below is the minimum code snippet that I can provide.Steps To Reproduce
Expected behavior
The PDF selected in ShareExtension is successfully uploaded to S3.
Amplify Framework Version
2.21.3
Amplify Categories
Storage
Dependency manager
Swift PM
Swift version
5.0
CLI version
No Responce
Xcode version
Version 15.0
Relevant log output
Is this a regression?
Yes
Regression additional context
No Responce
Platforms
iOS
OS Version
Main App iOS12.4 / ShareExtention iOS17.0
Device
iPhone15 Pro
Specific to simulators
No Responce
Additional context
I have conducted my own investigation regarding this issue and confirmed that the following operations work as expected:
Amplify.Auth.SignIn()
is executed withindidSelectPost()
of the ShareViewController UI, and authentication passes.Amplify.Storage.List()
is executed withindidSelectPost()
of the ShareViewController UI, and the expected information is retrieved with access levels ofpublic/private
. Furthermore, while investigating the origin of the error using breakpoints in Xcode, I observed that the error appears to be thrown at the following location:Amplify/Core/Support/AmplifyTask+OperationTaskAdapters.swift