iCloud drive - is it possible to access user files - ios

I configured my IOS project to work with iCloud drive. Now I'm able to store and read files from my app's ubiquitous container.
Is it however possible to access also files from root directory of iCloud?
Let's assume the user put some movie file into his iCloud Drive folder on Mac. The movie file can be now seen and downloaded using iCloud Drive application on Iphone. Can I also access this file from my application?
Or, to put it in other way, can I query for and access files uploaded by user to his iCloud root folder?
Edit:
From my investigation it looks that the only way to access these files is using UIDocumentPickerViewController. I didn't find any solution to access the files programatically so that I can filter them and display to user using custom UI.

Related

How to access all the iCloud drive files (outside app container) without UIDocumentPickerViewController?

I need to make an app that fetches data from iCloud Drive (outside app container, all the user files stored in the iCloud) and shows it in UICollectionView. Is it possible without UIDocumentPickerViewController?
You can do the same using the iCloud integration. with iCloud integration you can upload and get the data from iCloud here are some reference tutorial to kickstart.
https://www.raywenderlich.com/1000-cloudkit-tutorial-getting-started
https://iosdevcenters.blogspot.com/2017/03/icloud-integration-in-swift-30.html

How to get files/folders list out of our App container in the iCloud Drive by using the NSMetaDataQuery API?

I know every App in iCloud Drive can be thought as a container.
I want to know how to get files/folders list out of my App's container in the iCloud Drive by using the NSMetadataQuery API.
I have tried to use NSMetadataQuery to search it by setting the scope in the NSMetadataQueryAccessibleUbiquitousExternalDocumentsScope, but there is nothing response.
There is an example in ShapeEdit but there is still nothing there when I change the scope to NSMetadataQueryAccessibleUbiquitousExternalDocumentsScope.
I want to get all files or folders out of my app in the iCloud Drive like using UIDocumentPickerViewController but don't want to have User Interface interactive like UIDocumentPickerViewController.
Is UIDocumentPickerViewController the only way to access the iCloud Drive?

How to allow the folder to be modified by the app only?

I've a strange requirement regarding for my app which using the Google Drive SDK. I'm creating a folder and a file(Single File) through app on the Google Drive. Now I want that folder to be modified by the app only. Is this feasible?
Why I need this?
I'm writing/syncing my app data to the user's drive. I'm creating a Folder and a file on the Drive.
Now the file can be modified by the user if he visit the Drive on browser or by some other medium.
So, If the file is modified, user will not be able to access his synced data on other devices.
I do not have my own server where I can store the data.
So, I want that file should be modified by the app only. How can I do this? Is this feasible with the current SDKs available? What else are the alternatives for me to get the project done?
Please Note : I do not have my own server.
I don't think this is feasible for the reason that I haven't read anything about it in the docs nor have I seen a working implementation of it.
The closest thing I can relate to this is Permissions for Shared Files's. But the restricting of file/folder happens to both browser and native app. They're always synced.
You can set the restricted folder to Reader role. Users will only be allowed to:
-Read the metadata (e.g. name, description) of the file or folder
-Read the content of the file
-Read the list of items in the folder
Check this iOS code on how to set the permissions.

How to upload file to iCloud Drive?

In My app I want to upload PDF files to iCloud drive which use can access from URL https://www.icloud.com/#iclouddrive .
I have try mane code like
https://github.com/iRareMedia/iCloudDocumentSync
http://www.raywenderlich.com/6015/beginning-icloud-in-ios-5-tutorial-part-1
http://www.raywenderlich.com/12779/icloud-and-uidocument-beyond-the-basics-part-1
but non of the above help me to upload file to iCloud Drive. Above all example is used to sync files between two device through the app. But I want to upload to Drive so the user can access them with out the app also. I want to implement this form App.

App folder in Dropbox

In my application I want to fetch all audio files from Apps/App Folder using Dropbox api. I have used sync api and Datastore api but I am not able to create App folder inside 'Apps/'.
Please any one help me to find where I am wrong.
Thanks.
Once you authenticate the app within iOS it should create the folder for you, it's root dir would be '/'. As seen on their docs:
http://www.dropbox.com/developers/core/start/ios
Near the bottom? This will show you how to list all files.
EDIT:
From the link you gave me:
"With a file system in hand, you can start reading and writing files
(represented by a DBFile). If you're using the App folder permission,
your App Folder won't contain any files when a user first links with
your app, but it's easy to create one."
https://www.dropbox.com/developers/reference/devguide#app-permissions
"App folder
A dedicated folder named after your app is created within the Apps folder of a user's Dropbox. Your app gets read and write access to
this folder only and users can provide content to your app by moving
files into this folder. Your app can also read and write datastores
using the Datastore API."

Resources