I am developing an application that consists of the annotation registry.
In the form, I want the user to add files like .doc .jpg or .pdf
My question is about importing pdf and doc. Where can I import them into my app?
Can I get files from DropBox, Google Drive or iCloud?
Is there somewhere on the iPhone where my files get saved and I can get them to add to my app?
I think UIDocumentPickerViewController is a proper tool for that.
Related
I have a website within WKWebView that has a link to open a PDF, I want to intercept this so that it brings up a share sheet to save the PDF to the iPhone files app.
New to swift so unsure how to do this, I've tried many solutions from other answers and whilst https://stackoverflow.com/a/60614921/11868620 works well, it saves it to a Documents folder linked to my app rather than the Downloads folder in the Files app.
How do I implement this functionality?
We have created custom UTI of the file type in XML format for our iOS app. It is working fine for all other cloud service provider except for google drive. We are using UIDocumentBrowserViewController and defined our custom UTI in the app.plist file. Still, Google drive shows our application files as dimmed, as the user is unable to select the file stored in the drive. We can open the file if we provide public.xml as UTI in app.plist. But We don't want to open any XML format in our app, as we have customized XML tag for our app. Any help /point to get it solved would be highly appreciated. Thank you in advance.
I have a share extension in my app. It does share photos from photos app and .pdf files from files app. But it does not work on .txt or .csv files. What do I have to do to allow it?
I found by accident that in order to work with these text files, you have to add to plist of your extension NSExtensionActivationSupportsText than your app will popup in list of available apps to share into
Right now, the PDFs I download on my app are being stored in the app's document directory and can be retrieved only within the app. Is there any way to store the PDF files in the common documents directory that can be accessed by other apps?
If not, is there a way of storing my downloaded PDFs in other apps' documents directory (let's say iBooks), so that it will always be stored in iBooks.
If there are any ways, please elaborate.
There is no "commun documents directory" on iOS, each App is launched in is own sandbox and cannot access the files from other app directly.
I suggest you to check the iOS File System Basics guide from Apple in order to understand better what's happening behind the scenes.
You can still use an UIActivityController in your code to perform an export of your pdf file to iBooks or any app accepting this kind of file, but it requires some user interaction.
I'm using iOS8 UIDocumentPickerViewController to export and import a zip file to different cloud services (iCloud,DropBox,Drive, etc.).
I don't have issues with iCloud and Dropbox, but with Google Drive I can't import the file because it is grayed out in the interface that displays files (export is working like a charm).
The funny thing is that if I upload a zip file to Drive via the Web interface, the file is not grayed out and I can import it via UIDocumentPickerViewController - so I suspect this is an issue during the export that create the issue when I want to import the zip file.
Notes:
The exported zip file can of course be downloaded via Google drive web interface.
I tried to use a proprietary extensions (instead of .zip) defined it the info.plist, but it is the same result (works everywhere except when importing from Drive)
I thought the issue was with the UTI passed to UIDocumentPickerViewController but I tried all kind of UTI (kUTTypeZipArchive, #"public.archive", #"public.zip-archive") with no success (in both case: with a proprietary extension, or with a .zip extension)
I also export/import XML files (with a proprietary extension) and everything is working well for all cloud services including Drive - I just had to add the "public.data" UTI in the allowed UTIs in UIDocumentPickerViewController.
This seems to be a bug in Google Drive. It does not handle the allowedUTIs correctly.
I also wanted to open my own proprietary types, but they didn't work. I had to add "public.data" to allow all files and check the extension when a document was picked. This is not as nice as if only my types were available in the picker, but it works.