I'm developping a messaging app allowing user to add attachments to their messages.
Is there a way to open every files type ? Maybe like Intent in Android ? Or in WebView ?
Types are docx, pdf, png, jpg, mov, xls, zip, mp3, etc.
There is an apple framework that can allow the user to view local files of these types.
QLPreviewController
This opens most local documents / media files.
To use you have to import QuickLook
Related
I'm uploading images to firebase and in return I'm getting uploaded image URL as https://firebasestorage.googleapis.com/v0/b/mobile-ae-4a739.appspot.com/o/images%2Feecae5f7-b578-483a-a2da-b166aaf5716c?alt=media&token=b6743df5-7276-4b83-8e2d-f741f42c956e.
Now, I have to display this image in QLPreviewController. I'm giving the above firebase URL of my uploaded image as QLPreviewItem, but QLPreviewController displaying filename text instead of image, you can see in the below screenshot. I confirm that the URL has image.
Can you please help me to show the images in QLPreviewController
QLPreviewItem works with local file URLs only, it won't download your file for you if you provide it a remote file url.
You need to download your file to your app's local file system before presenting QLPreviewController and provide it that local file url.
For advanced usage - multiple urls, dataSource, delegate handling - you should watch Quick Look Previews from the Ground Up from WWDC 2018.
I want siri to open pdf files that are stored into an app.
Is there a way to do this?
Siri -> open pdf file xyz
Thanks
First you need to write an app to render pdfs. Then you need add Document extension to that app to handle opening pdfs. Then you need to add siri extension to handle voice commands.
Its possible to upload a Pdf or documents file in DropBox with the using UIActivityViewController like WhatsApp to file sharing ?
All you have to do is download the Dropbox app and make sure it's in the list of share options. I can't say if I know it's like WhatsApp, but that's how I share to Dropbox.
I've saved a file locally and want to open it in Word if installed. For example my file's URL is:
file:///var/mobile/Containers/Data/Application/{guid}/Library/Caches/MyFile.docx
My Office URL is:
ms-word:ofe|u|file:///var/mobile/Containers/Data/Application/{guid}/Library/Caches/MyFile.docx|p|my-protocol
When Word launches it says:
The link you clicked on is invalid and the document cannot be opened
However if I feed the original URL to a UIDocumentInteractionController it opens correctly.
Any ideas?
If you pass the URL to Word directly you are attempting to violate your Application Sandbox - Word doesn't have access to your App's directory, so it can't read the file.
You have to use the UIDocumentInteractionController to prompt the user to open the document in Word or you need to store the document somewhere that Word can read it (this would be external to your device - on a cloud store somewhere)
whenever we sync pdf files. it shows in our app.
because I want upload that pdf file on server.
but I couldn't find any other way to do that.
I have tried to access pdf from iBooks but there is no way to access other app file in our app.
so is their any way to do that?
appreciate for help
You can upload the PDF to your server and show a webview where you load the URL for your PDF file