Share multiple files via UIActivityViewController to Dropbox - ios

My application works with HealthKit data in order to create some reports from the user's workout data and exports them to one or more files (mainly CSV and sometimes GPX files). To allow the user to access these files I present the standard UIActivityViewController passing as items an array of file as [URL] and no application activities (this is the relevant line in the code where files is the array of URLs).
It all works without issues, but today one of my users reported that when multiple files are exported and Dropbox is selected as the target for sharing the files, only the first one is saved and the others are ignored. Is there something I can do about it or is an issue that must be solved by Dropbox? To my understanding it should be the latter, but I can be missing something.
If they are relevant, here are two screenshot of the sharing screen under iOS 13: in the first only one CSV file is being shared and there's a Save to Dropbox option, in the second I'm sharing 2 CSV and 1 GPX files and that option is no longer there. In the second case there's still Copy to Dropbox (hidden) and it leads to only one file being saved, if I use Save to Files, all 3 files are correctly saved.

Marco,
You are right, this is a Dropbox issue, not an issue with your apps export. It looks like the Dropbox app, by default, only accepts one file when received from the export action. Here is the workaround. The native iOS Files app will accept multiple export files and it is possible to add the Dropbox folders to the Files app, effectively allowing the multiple files to be uploaded to Dropbox.
Adding Dropbox to Files app:
Open Files app, on the app main screen, click the three dots in the upper right corner, and select edit.
This will show a ghosted Dropbox file with a toggle switch next to it, tap to add Dropbox to the list of available files.
Exporting the Multiple Files to Dropbox:
Once steps 1 and 2 are complete, go to the desired export app, and select the file you want to export.
In the list of export options, select the iOS Files app (not Dropbox), and then select the Dropbox file within the Files app. Then you can select the Dropbox sub-folder you want the multiple export files to be placed in.
That accomplishes the desired goal in the same number of steps as exporting to DropBox.

Related

How can I access the contents of a folder selected from Files app?

Basically my app works like a iCloud-based note app (for example, logseq). Users first select a folder in Files app, then my app starts downloading/updating the contents of the folder.
So I implemented folder selection via UIDocumentPickerViewController, after I got the folder path in Files app. I tried downloading a hardcoded file like (<the folder path user just selected>/fileList.json) via FileManager.startDownloadingUbiquitousItem, got 257 permission error (the file does exist in my icloud drive). Then I followed the answer from this answer to call startAccessingSecurityScopedResource. It always returns false and the same 257 error returned.
Perhaps, I cannot access a random file from a selected folder? but how can those note apps work by simply letting users selecting a root folder?
Answering my own question after some debugging. Call startAccessingSecurityScopedResource on the folder path you grabbed from picker, not its subfiles. After that, you can start downloading its subfiles via startDownloadingUbiquitousItem

How do I put content into the iOS Documents folder at compile time, using Xamarin?

I have a data file that I need to include with my app when I distribute it. When loading any files in the app, I prefix the file name with:
Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments)
This works great for anything I create within the app (and for reading back), like files I download in response to a user action. But I can't for the life of me figure out how to place files there when I build my app in Visual Studio.
I've tried making a "Documents" subdirectory in the special "Resources" folder, but that didn't work (I tried setting the "Build Action" to both BundleResource and Content). When I look at the folder for my app (from using the simulator) I can see that in the "Documents" folder there's all the files I downloaded, but I can't find my data file that I'm trying to bundle ahead of time. I even searched my entire hard drive on the Mac and still couldn't find said data file.
The data file isn't an image, if it matters. Just raw binary data. How do I set it up so that this file goes into the proper documents directory at compile time, so that I can read it using the SpecialFolder.MyDocuments prefix? Thanks.
You can't. You can include files in your app bundle, and then at startup copy them from the bundle into a user folder. But this won't happen automatically.

Sample files in the documents folder after installing the app

is there a way that I can add sample files to the documents folder of an iOS-app before the app is actually started for the first time. For instance at install time.
For instance, I am writing a text editor and want to have a sample document, that the user can look at showing some of the features of the app. Could this sample be placed in some folder in Xcode and added to the documents folder automatically or do I have to add it from my code, the first time the app starts?
You can access files in sandbox.
Add some resources files. You can load them and save them the way you want.

iOS file browser example

Does anyone have some sample code demonstrating how to make a "file browser" view? I'd like to be able to navigate through directories and drill-down the sub-directories and see files located within the various folders. I want the user to be able to create new directories/files and even select an existing file. Is there sample code out there already available to do this?
I don't know about sample code, but this wouldn't be too complicated to achieve using NSFileManager and a UITableView.
You can obtain arrays of directory contents using the subpathsOfDirectoryAtPath:error and associated methods of a file manager. These arrays in turn can populate a UITableView. It would be fairly easy to put together a navigation controller that could display a series of table views showing a file hiearchy.
Bear in mind, however, that you'll only be able to access the directories inside your application sandbox, unless you're running on a jailbroken device.
The iOS programming guide says that
You should never present users with the list of files in this directory and ask them to decide what to do with those files. Instead, sort through the files programmatically and add files without prompting.
This is assuming you are trying to implement file browse feature for your documents directory.
I'm an author of FileExplorer which is a file browser for iOS and fulfills most of your requirements.
Here are some of the features of my control:
Possibility to choose files or/and directories if there is a need for that
Possiblity to remove files or/and directories if there is a need for that
Built-in search functionality
View Audio, Video, Image and PDF files.
Possibility to add support for any file type.
You can find my control here.

How to upload multiple documents to SharePoint at the same time?

I am trying to upload many documents to a library of SharePoint 2007, but it's too bad that I have to upload each by itself. Isn't there a way to upload more than one at the same time?
Have you tried using the multiple upload control, its an activex so you will have to use IE
http://office.microsoft.com/en-us/windows-sharepoint-services-help/working-with-sharepoint-document-libraries-HA001141287.aspx
Click Upload Document.
On the Upload Document page, click Upload Multiple Files.
Go the folder where you downloaded the practice files.
Select the two Word files (Memo_Draft.doc and Memo_Final.doc) by
selecting the check box next to each
file.
Click Save and Close.
If you cannot see the option, you may need to update to the latest CU
http://social.technet.microsoft.com/Forums/en-US/sharepointgeneral/thread/17b654fd-6e83-47b6-80ab-995ed1eabae9

Resources