How to share a bunch of files at once in iOS - ios

I need to share some data, e.g. two images, to other apps like dropbox or gdrive.
Some recommend using UIActivityViewController but there's no option for mimetypes and other recommend using UIDocumentInteractionController but this seems only be suitable for single files...
Does anybody know about the right way and/or can provide some example in swift?
Edit:
UIActivityViewController seems to be the right way and NSURL.fileURLWithPath(filePath) provides the content.
But what about files stored on a server? Those must be downloaded at some point during share process (e.g. after choosing dropbox). How can I achieve this? I tried with a customized UIActivityItemSource with no luck.
Thanks.

Take a look at the Apple doc for UIPasteboard.

Using UIActivityViewController is the right way.
I had to provide my files wrapped in a subclass of UIActivityItemProvider.
Overriding item()-function for downloading and providing my binary content.

Related

Reading .bundle files in Cocoa Application

I am creating a cocoa web browser using WKWebView and Swift. Like most browsers, they have extensions or plugins. I want to implement the same thing in my web browser. I came across CFPlugin. I want to use this feature but I do not know how. It would be good if you give a sample application.
I haven't tried anything because I don't know what to do
This is how I want my extension to look like
myExtension.bundle/
info.plist
scripts1.js
popoverview.xib
popoverview.swift
script2.js
popuppage.html
image.png
popuppage.css
I want to know how to read the files in the bundle
Thanks!
After a few minutes of trying I found the answer
Bundles are considered as Directories
so you can do something like this
MyBundle.bundle/Contents/Info.plist
MyBundle.bundle/Contents/Resources/MyView.xib

Can we share PDF or other documents using JSQMessanger?

We want to share PDF or other documents using JSQMessanger. Because we have used JSQMessanger for chating in our App.
You should expand JSQ functionalities for the PDF source
Look at how the example app does media items i.e. Video or images. It will be similar to this and then you just need to adapt it so that it can handle the PDF payload. Definitely a great thing to add to the library.

UIDocumentPickerViewController Limitations, Multiple Files selection at once

In order to be able to access iCloud Drive from the application,
I think that we want to use UIDocumentPickerViewController from the application.
but i found following problems when i use UIDocumentPickerViewController.
Cannot upload multiple files at once.
Cannot Download multiple files at once.
When pushViewController from navigationController then display
become strange.
I want to avoid above problems, So is there any another way to get files information from iCloudDrive without using UIDocumentPickerViewController?
like Send some request or query.
I have searched lot and didn't find any query or request to get Files ,Upload files and download files from iCloudDrive.
if you have any idea about this please tell me.
Thanks,
I don't think there's any straightforward alternative, but you could think of...
...using iCloud directly (not iCloud Drive), but then users will only have access to their files from your application
...using Google Drive's sharing extension which supports uploading multiple files at once (the Dropbox SDK probably supports that, too, but their sharing extension doesn't)
...zipping all files before uploading them
...changing the file format so that it's a bundle of multiple files, if you are in control of the file format
...file a radar/feature request, and possibly wait forever ;)
Not sure if that helps, but I don't think you have much of a choice here.

Adding image sets to images.xcassets catalog programmatically in iOS?

I've searched high and low on stackoverflow and google for an answer to this question. Perhaps it's not possible, or I may need to devise a different method to do this.
In our iOS app we have a whole bunch of image sets in images.xcassets. But we're moving to a more dynamic environment where we'll be downloading image sets instead.
I'd like to try and stick with the convention of having everything in the images.xcassets folder. Except as said, I want to dynamically create the image sets based on the data we retrieve from our server. Is this possible?
So there is a way to do this, but it's iOS 8.0 and above. Unfortunately, we're supporting 7 and above so I can't use it.
But for anyone else who's interested, you can use the UIImageAsset class to do what you need to do when you want to create a container for your images to encapsulate different resolutions, as the images.xcassets container currently does.
UIImageAsset docs
This answer gives a good overview of the XCAssets folder at runtime: Can I access an xcassets directory on the filesystem? - it looks like it's the wrong way of going about things.
I believe it is recommended that you use the temp or document folders, depending on the how long you wish to keep these images (https://developer.apple.com/library/ios/documentation/FileManagement/Conceptual/FileSystemProgrammingGuide/FileSystemOverview/FileSystemOverview.html).

PSPDFKit add network image into scrollview like pdf page

I'm using PSPDFKit in my app. I want to load remote images async with the framework, cause there are both images and normal files in my app. I have tried convert imageData into PDFDataProvider, which cannot be Asynchronous. Does anyone have ideas?
Author of PSPDFKit here. Please contact us for feature requests directly, we only rarely monitor StackOverflow - that's not the right platform to provide support for commercial products.
That being said, the PSPDFViewController is designed to present PDF files - we don't have immediate plans to add support for other file types.

Resources