CodenameOne – Sharing/importing files through the ‘Documents’ app folder

Asked By: Anonymous

My Android app is also being developed for iOS. For iOS versions <14 I am using a cross-platform tool, called CodenameOne.
For cross-platform’s sake it has limitations, of course.

I am trying to accomplish a simple import/export feature. My app can share simple json files.

Sharing is possible only with images in CN1 at present time. It is not useful to me, however I did not test it, usually they put files in the inbox of apps, it has to be checked according to use cases.

Sending an email with the sendMessage method does not work (it blocks the app, with or without attachments/recipients)

and moreover I would like that the user can do it in a pleasant way.

So I am using the app Documents directory as a folder for importing/exporting.

Also the custom extension is registered (it is not ".json").

Here are some ios build hints injected in the CN1 build system.

<key>UTExportedTypeDeclarations</key><array> <dict><key>UTTypeDescription</key><string>List of datatype</string><key>UTTypeConformsTo</key><array><string>public.json</string><string>public.database</string><string>public.data</string><string>public.text</string><string>public.content</string></array><key>UTTypeIdentifier</key><string>com.myapp.datatype</string><key>UTTypeTagSpecification</key><dict><key>public.filename-extension</key><array><string>ext</string></array><key>public.mime-type</key><array><string>application/json</string> </array> </dict> </dict> </array>

(above: "ext" stands for my custom extension, the file is in the json format)

and

ios.UISupportsDocumentBrowser=true

ios.UIFileSharingEnabled=true

(there are also other hints as requested to handle files and media on iOS)

I tested the app on the iOS simulator but the Documents app folder is not seen in the Files app as expected with the specific hints, and the files with the extension are not calling the app (with AppArg in the start method) when opened (the AppArg code works in the CN simulator instead).

Maybe there are issues with iOS recent versions? Indeed I am testing it on iOS 14 because the Swift version is not ready and will be published later.

What can be done to get this functionalities working?

What’s wrong? What test/debug can be done?


Solution

Answered By: Anonymous

UIFileSharingEnabled seems to be supported: https://developer.apple.com/documentation/bundleresources/information_property_list/uifilesharingenabled

But the casing is wrong and should be ios.fileSharingEnabled=true.

As far as I can tell there’s not support for ios.UISupportsDocumentBrowser. Where did you get that build hint from?

You should use ios.plistInject for unsupported hints. I suggest reviewing the resulting xcode project to see that things made it into the plist.

techinplanet staff

techinplanet staff


Windows 10 Kaufen Windows 10 Pro Office 2019 Kaufen Office 365 Lizenz Windows 10 Home Lizenz Office 2019 Home Business Kaufen windows office 365 satın al follower kaufen instagram follower kaufen porno