How to force open an excel file with appropriate app in Swift in my iOS app - ios

I succeeded to make an excel file by using libXlsxWriter in Swift in my App and I have an URL that represent the excel file.
I made Share button for users to share the excel file easily by using UIDocumentInteractionController.
Now I want to add an Open button for users to open the excel file easily with appropriate app such as Microsoft Excel and Polaris Office in my App.
(I know that I can select Polaris Office and Microsoft Excel when I clicked share button but the other share methods are also shown. I want to force open excel app)
However I couldn't find a solution.
How can I force to open excel file with appropriate apps from URL in Swift?
Is it possible?

Related

Open linked XLSM file in Excel app on iOS

My goal is to link an Excel macro file from a web app. When clicked, it should be opened in the already installed Microsoft Office Excel app. Target devices are iPads and iPhones running iOS 11 and above.
What I have tried so far is to link the file using the schema:
ms-excel:ofe|u|https://myserver.com/somedirectory/myfile.xlsm, so no passback protocol or document context defined. When I click the link the Excel app opens but then displays a message that it is not possible in this version of office to open a file from this server. Manual I have used: https://learn.microsoft.com/en-us/office/client-developer/integration/integrate-with-office-from-ios-applications
So I did a research and found that it might be one of the following reasons:
URL is not encoded: I therefore tried to encode only the part after the |u| marker and also the full string. Neither of them worked.
Only links to SharePoint and OneDrive are supported: Hosted an Excel file on my OneDrive account and tried the public share link. This worked, however, the file was not opened in the installed Excel app on the device but in the online Excel editor inside Safari browser.
My conclusion is that the URL was formatted properly but Excel really does NOT allow any files loaded from own servers / other servers than OneDrive or SharePoint.
Can anyone confirm this for sure? Or is there a way how I can open an Excel file from an own server using the installed Excel app on my iOS device? Maybe there is a solution to somehow load the external file to OneDrive and then open it in the app, like https://onedrive.com/loadFile?url=https://myserver.com/somedirectory/myfile.xlsm?
Thank you in advance!
The URL scheme linked in the document only works for files hosted in FileShare or OneDrive. No other cloud services or local files.
See https://stackoverflow.com/a/52223696/1049134.
I got it to work using a webdav server, so I think that is the solution if you don't want to use a cloud service. Opening the file directly on the webserver will not work.

How to allow user to upload attachments in iOS application

In case of Android when I want to send or attach a document such as a pdf or doc from my application I can easily access all the files in the external storage and share or attach.
But since iOS follows a sandbox approach as well as there is no filesystem so it is not possible to attach or upload in same manner.
In my iOS application right now, I have implemented Open In functionality, wherein in the info.plist file I have specified that my application supports all types of documents so when the user opens any documents he gets an option to Open In my application, then I save that document in the
Documents/Incoming
folder in the application, now when my user clicks to add attachment then he can see the document to attach, since this is a long process I was looking for better ones.
I saw whatsApp allows uploading/sharing from iCloud apart from that what can I do to provide a similar behaviour as Android.

Accessing files through Google Drive picker in iOS

I want to select file from Google drive app and download metadata. How can i do this in iOS without querying for all files and display on my own like this?
Here they have just provided picker API for webapp : https://developers.google.com/picker/docs/

BlackBerry default app for Epub file type

I'm developing an Epub reader on BlackBerry java platform, and I'd like to know if there is a possible way to register my application as the default reader for Epub files, like if a clicked on an attached Epub file within an email, or a link to that file in browser, or even if I clicked on it while browsing all files locally, am I going so far with this? is it possible?
Try using the Content Handler APIs, which allow you to register an app to handle files of a particular extension and content type (e.g. .epub and type application/epub+zip).
See this BlackBerry reference document for more information
If you install the full SDK, you should also find the CHAPIdemo sample code under samples/com/rim/samples/device/chapidemo.

How can I implement a file browser in iOS

I want to open a file browser when I click a button in my application. For example if we want to send an email, we will attach a file by clicking attach file button. Like wise in iOS
if I click a button, a file browser should open and it should be possible to open a file with the ending pdf.
This isn't possible. Your app can only act in it's sandbox or access files which are meant to be shared (like photos or contacts).

Resources