UIDocumentPickerViewController Limitations, Multiple Files selection at once - ios

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.

Related

Working with custom user files

I'm currently studying swift and came up with such a question:
What are best practices to work with custom user files like .pdf, .doc?
For instance, I have application, that loads different files from server like .pdf, .ppt, .zip and so on, how to present them inside my app?
While googling I came up with solutions mainly for images, but nothing particular for other file types.
For now, what I have is - downloading files from server using Alamofire and saving them to documents directory.
Could anyone please recommend how to present this files inside my app after I saved them?
Possible solution that comes to my mind is web view, but what about zip? Is there some kind of universal solution? I know that there is Files App in iOS 11, but what about iOS 10?
Many thanks for your attention!

Is it possible to gain forever access to a file imported from DocumentPicker?

I have an app that imports a file (or many files) using the DocumentPickerDelegate. This means that the files imported are likely off of iCloud, Google Drive, etc. I want the app to load any previously selected files on startup, but I'm wondering if this will be possible, since it looks like you lose access to the files once the app closes.
Does anyone know a way around this? For example, are you able to actually copy the imported files to the apps local data?
Thanks for your help!
In the delegate where it gives you the URLs of the selected files you need to make local copies of the files before the delegatecall completes. This is covered in the documentation for UIDocumentPickerController.

iOS list document from directory download?

I want to allow users of my app to send PDF which is in the device.
The problem is, I don't see how to do that...
First, where are the files downloaded ? In which directory ? And how to list these files ?
I see there is NSfileManager but I don't understand how to use that.
I want something like DocumentPicker. (but available for iOS 7)
There is no common central directory in iOS that stores PDF files in way you describe. Nothing.
Each app has its own Documents folder, and apps have absolutely no way to see each others docs folder. So you, as a new pdf manager custom written app will not be able to look into other apps docs folder.
NSFileManager is a standard Cocoa class the handles files in a generic manner.

Encrypting or protecting files stored in iOS app's NSDocumentsDirectory

I have a custom requirement in one of my products and I need to protect or encrypt files that are stored inside the NSDocumentsDirectory folder. Even if these documents are mailed (The app has the ability to mail documents) to some other person , he or she will not be able to open this document without using my app (I will be using open in functionality of email attachments). So basically only the application can access all these documents and without the app the documents should be mere junk. IS there any way to do it, or has any one done something before.
I also saw this but could not get a complete idea.
If you want a quick and easy method for data that doesn't need serious security, just zip the files with a fixed password.
ZipArchive is a good library for this.
For a more serious approach, check iOS - Protecting files with a custom encryption key?
The other post you mentioned works on the concept of password protecting the files, I had encountered the same issue that was for my custom defined files in which our team, encoded the contents of the file on random locations, and saved it.
Only our Application could decode it correctly as we had the key :)
It was a windows application, It would work here also.

Download FTP directory contents to ios

I have a website, let's say it's "http://www.jwilkthings.com/stuff"
I have a bunch of .txt files stored on this website, i.e. "http://www.jwilkthings.com/stuff/text1.txt"
What I'm wanting to do is find a way in iOS to download all of those text files without knowing what the document name is. I can already retrieve them manually as long as I have a file name, but I would rather just get all of them at once and put them in the documents directory if possible. I currently use FileZilla to upload all of the text files, so I can use FTP if needed.
The correct way to solve this problem is to not use FTP (riddled with performance and security issues), and to configure your web server to expose a table of contents directory listing that your client can parse.
But that's not an answer to your question.
If you really want your iOS app to speak FTP, take a look at the SimpleFTP sample project from Apple.
It's old, but I just got it to build on iOS 5. The ListController.m file has the code you're looking for.

Resources