Prohibit exporting or sharing documents in UIDocumentBrowserViewController - ios

Is there any way to prohibit exporting files in my UIDocumentBrowserViewController-based application that also provides a FileProvider?
The user should only be allowed to view and edit files in the app.
The user should be able to move files around within the FileProvider resource, add new folders, ...
Context:
I'm building an enterprise app that grants access to a network file system with sensitive information.
I'm using a FileProvider extension that only can be used inside my app.
I thought of achieving this via the FPUIActionExtensionViewController by throwing authentication errors if the FileProvider is being accessed from other apps.
I want to avoid building my own UI and use the one that Apple provides for free.

No, not really. Neither would it make sense to have such a control since taking a screenshot is trivial, and even if you could disable that, taking a photo of the screen is still possible.

Yes, this is built-in. Make your app a managed enterprise app ; then you can control access to the files with configuration profiles.

Related

iOS, config files and sandboxing

My understanding is that because of sandboxing, it isn't possible to view any text file (ie config file) associated with an iOS app using another app. Something quite simple with Android. Am I mistaken?
I am trying to implement a text config file with a Unity iOS app that gets loaded and parsed once when the application boots.
This config file would also be able to be edited and saved manually on that actual iOS device.
(addendum)
In Unity there is PersistentDataPath which resolves to /var/mobile/Container/Data/Application/foo/Documents
Is there an iOS supported file explorer app that will allow me view and edit files in this location (without jailbreaking)?
Use can check iOS App Groups. It allows multiple apps access to shared containers and allow interprocess communication. There is no so much documentation about this, but maybe that's what you're looking for. At least you can share NSUserDefaults between the apps.
NSUserDefaults it's a most simple way to save any (not big) configurations for your app. For manual editing: if your app on the device signed with developer certificate, you can connect through any iOS supported file explorer app and edit it. But after release, from App Store, your app installed in restricted/private path, so it's not possible, if only you don't have a jailbreak.
Initial configuration you can put into your app bundle, and at the first run just copy them to NSUserDefaults.
Short answer: There are utilities such as iExplorer - https://macroplant.com - that allow "file manager" type access. However...
Long answer: If your app requires users to buy (or get) other software to modify configuration files, the chances of Apple approving it are slim to none.
The appropriate thing to do is to provide a User Interface in your own app which allows the user to modify / update the settings.

Is there a way to open an editor app in ios and receive edited results?

I have an app that downloads files from a web server. Our customer wants the ability to edit those files on their mobile devices and upload the edited version to our servers. Is this possible in iOS? I have figured out how to allow users to view the files in external apps, but I don't see a way to bring back their changes if the file was modified as it seems to copy the file into the other app's space, so my app is left with the unaltered version.
iOS has a sandbox mechanism, so for sure you can not modify any file in another app.
The only way to transfer data from different app is using sharing.
This is a sample project I wrote for implement sharing on iOS, check it:
Sample for sharing on iOS
Hope it can help you.

How to access all the files(pdf, doc etc) in iOS?

How can I find out programmatically all the files present in iOS device and list them out to user? Also I need to download the file in my local application database?
How this can be achieved with Objective-C.
You cannot access all files in an iOS device outside the sandbox of the app. But there are other ways you can achieve this. What you can do is:
Access all the files in Gallery using UIImagePickerController.
Access all the user files in network- Dropbox/Google drive/iCloud. They all have separate public APIs that can be downloaded and used to download/upload files in network.
In this way, you can access most of the user files and use the same in your application.
Simple answer : you can't (on a non-jailbroken device).
Each app is launched is in own sandbox and can't interact with the others apps, expect using API provided by Apple for app-communication (ex: extension)
You should look at that Apple guide about App Sandboxing, which is valid for OSX and iOS apps.
The main difference between these two OS, as quoted directly from the doc :
iOS Note: Because it is not for user documents, an OS X container
differs from an iOS container—which, in iOS, is the one and only
location for user documents. In addition, an iOS container contains
the app itself. This is not so in OS X.
You cannot access all the files outside the app sandbox. But, if they are available at some shared location(network), you can use third party libraries to access them. For eg.
1. For iCloud- iOS provides inbuilt framework of UIDocument
2. For dropbox- DropBoxAPI is available
3. For Google drive- there is a separate library to access files in the drive.
Hope this helps :)

ios copy file to another apps file directory

Is there anyone that got an idea of how to copy files to another apps file directory in ios? I need a service for this so I can from my app simply hit a button and what my app does is copy a file to another apps directory? will that be possible? I am ready to pay for a person that can help me with this?
iOS apps are sandboxed and are not able to directly access the contents of another app's data. There are ways for apps to interact with each other, but these require user interaction and are limited to specific use cases. For more info, here are some docs from Apple on inter-app communication:
Document Interaction Programming Topics for iOS
Inter-App Communication

File Manager equivalent on iOS?

I'm making a video decoder application on iOS using Xcode 4.2.
On click of a button I need to choose an input file to decode from a list of files.
Since there is no File Manager or File Browser on iOS, is there any way to go about this?
As others have pointed out, there is no iOS file manager. What there is the FileManager class. This class provides you the ability to:
get read-only access to items in your app package
get read/write access to your app's sandboxed container
You cannot access files elsewhere on the device, nor files belonging to other applications.
Some iOS applications (camera, pictures, contacts, etc) can be interacted with in a limited fashion by iOS API's that apple provides for that purpose. You can get more information about this in the apple developer docs online.
Thus, if your files are in your local app sandbox you can use FileManager to manually build a UI that allows users to see lists of the files there and pick one. They key being "you can build" on top of FileManager's functions for accessing the file tree.

Resources