-
-
Notifications
You must be signed in to change notification settings - Fork 8
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ui-document-picker returns file path that can't be used to open a file #21
Comments
@BikeBr0 you ll need to give more details. code, logs... |
Yep, I'm working on that. Sorry for the delay. |
@BikeBr0 android 12? |
Broken on Android 12 and iOS 15.2. Works on Android 8.1. iOS 12.5 is acting weird in general... |
@BikeBr0 sadly the error is on N side. N does not support android 12 scope storage (opening files outside of the scope of your app). |
Thanks @farfromrefug. I can live without Android support but I really need to get this feature working on iOS. I'll add more comments with my iOS debug info. |
After resolving xCode issues, I was able to get my test-app to run on iOS again. iOS 12.5
iOS 15.2
Are extensions mandatory on iOS? Is it not possible to select any file? |
@BikeBr0 thanks for the details! should be fixed in 1.1.12 |
Great! 1.1.12 fixed the undefined error when not supplying the FilePickerOptions to openFilePicker(). Even better, I am able to open files on iOS. The secret is to remove the leading 'file://' from the path:
This will allow you to browse the filesystem and select well known files (images, txt files, etc.). If you need to access uncommon/proprietary file types, you will need to define UTIs in App_Resources/iOS/Info.plist. Here's an example of a binary file type:
And the code that uses it:
This should let the user browse the file system but only select a file specified by extensions. UPDATE: This doesn't work for all users. Some users (not iOS version dependent) cannot select the file specified by the UTI. |
Just tested on |
@ray007 please you will need to give more details. Saying it does not work wont really allow us to help you. |
@farfromrefug what information would you like me to provide? let files = await openFilePicker({extensions: ['json'], multipleSelection: false}); and I can browse to the file I want to select, but it's greyed out and I cannot choose it. |
@ray007 that ;) On ios you can do what you are trying to do. You need to use https://developer.apple.com/documentation/uniformtypeidentifiers/system_declared_uniform_type_identifiers?language=objc |
Apple really seems to hate casual apple-developers. |
Is this still worked on? |
@rubenhr yes and it is all working. On iOS the issue is on N side. N does not support path with file:// at the beginning. You can manually remove it. |
On both iOS and Android I cannot open the file using the path returned by openFilePicker. For example, using {N} 8.1.5:
Then edit src/app/item/item-detail.component.html to open a filePicker:
And add the corresponding handler to src/app/item/item-detail.component.ts:
Then:
And test on the device.
Expected result: File name is printed to the console
Actual result: ERROR Error: Uncaught (in promise): Error: java.io.IOException: No such file or directory
Here is a more detailed stack trace:
The path returned on Android is, "content://com.android.providers.media.documents/document/image%3A122" and on iOS is "file:///private/var/mobile/Containers/Shared/AppGroup/1EA300C8-AE93-45E0-BE2F-4CF58C832464/File%20Provider%20Storage/Downloads/some-file.hex"
The text was updated successfully, but these errors were encountered: