How is it possible to read asset file with iOS?

Yew, this is working.
However, this is a workaround for small text....
I need to be able to store data in a file as I have lot of text in different languages that I manage with other tools
Anyway, thanks for this proposal

@Jacques_Dumarest Based in your target I think will be better if you put your text file in your web server. With your App you can access this file with the block WebViewer. This block runs well in iOS (inc. IPA) for a small text file <70 KB (ca 800 text-lines).
Additionaly in the future you will can change your text file without changing your App.

The blocks to use are similar theses


Thank you very much Ferran !
This is definitively a solution working for Android, iOS both companion and compiled App :slight_smile:

I have put my test text file on my Google Drive. I "build" the test file url using info provided here: https://www.howtogeek.com/747810/how-to-make-a-direct-download-link-for-google-drive-files/
In my app, I download the file (provide url and send GET) then I display the text: OK! Save the file and read the saved file, and again I get the correct text :smiley:

Keep attention that for a big text file the answer in iOS is very delayed. I had reported this issue to @ewpatton. For a more than 100 KB the answer time is not good in iOS.

Thanks

I've put this on my todo list for this week.

1 Like

:+1:

This works fine. However, If I download an audio file (.mp3), I get the file, but in order to play it, the file has to be the same name as the file on Google drive.
Is there a way to get the file name from the google ID?

And that should be the case (with Companion and the IPA).
Show your blocks and (a screenshot of) the audio path.

Thanks for your feedback.
I am downloading files from my Google drive using its FileID as described here: https://www.howtogeek.com/747810/how-to-make-a-direct-download-link-for-google-drive-files/.

If this file is a text file, I can save the file with any name, and it works with Companion, apk, ipa.

For media file (audio), result is different. If I try to download it, save it and play it I get the following results:

1- Download and save file with the same name as file in Google drive: /Cloche_Eglise.mp3

  • Companion Android: Playing audio file works Fine :smiley:
  • Android apk: Play fails, and I get the message: Error 701: Unable to load /Audio.mp3
  • Companion iOS: Download fails: Error 1102: The encoding utf8 is not supported .
  • iOS ipa: Download fails: Error 1102: The encoding utf8 is not supported .

2- Download and save file with a different name: /Audio.mp3

  • Companion Android: Play fails, and I get the message: Error 701: Unable to load /Audio.mp3
  • Android apk: Play fails, and I get the message: Error 701: Unable to load /Audio.mp3
  • Companion iOS: Download fails: Error 1102: The encoding utf8 is not supported .
  • iOS ipa: Download fails: Error 1102: The encoding utf8 is not supported .

Here is a screenshot of my App:


The full test program (testing texte, audio & image) is here:
Download_File_From_Google_Drive.aia (14.4 KB)

There is no problem at all, neither with Companion nor with the IPA.

I tried your solution, but seems I am doing something wrong :frowning:.
As you retrieve the file in Web1.GotFile, I assume you set SaveResonse to True (In the designer?) otherwise, GotText is called.
With SaveResponse True, I have the message: Error 1101: Unable to get a response with the specified URL: https://drive.google.com/uc?export=download&id=1........
Here is the screenshot of my project:


and the project file: Download_File_From_Google_Drive_V2.aia (11.1 KB)
Thank you very much for your help

Actually, what I describe above is for Android.
It is working for iOS

I set it in the Designer and there is no issue (error message). As I said, it works with Companion & the IPA.

Yes.

YES, your solution is working for iOS: both Companion et ipa.
The issue is with Android, companion and apk !
I suppose I should move this issue out of this category as it it not anymore an iOS issue.

Just a note that I've fixed the use of // in compiled IPAs locally. It will be in the next build server update.

1 Like

No. Since you have set DefaultFileScope = Legacy, the path (.ResponseFileName) on Android 11+ must be set to one of the Shared folders (/Download, /Music etc).

Thanks