Xcode Enable UIFileSharing at Runtime - ios

is there a way to enable itunes UiFileSharing at runtime?
I need to start my application with UiFileSharing Disabled and Enable it under superuser configuration

I'm pretty sure this isn't possible unfortunately, here's a similar question relating to changing the values of different settings in the info.plist file.
https://stackoverflow.com/a/1430351/879741
The best you could do I think is to not allow a non-registered user to look at and interact with the files being shared in-app. Stopping a non-registered user from adding/removing files from iTunes wouldn't be possible. File sharing is either off or on.

Related

Prohibit exporting or sharing documents in UIDocumentBrowserViewController

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.

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.

In-App Settings or Settings Bundle

What's the better approach, use In-App Settings (A Screen on Startup) or use the Settings Bundle and if nothing is entered show a popup on start? Or is it possible to combine both?
BR,
mybecks
Apple says:
Which option you choose depends on how you expect users to interact with preferences. The Settings bundle is generally the preferred mechanism for displaying preferences. However, games and other apps that contain configuration options or other frequently accessed preferences might want to present them inside the app instead.
Therefore if the settings are going to be used frequently use in-app settings, otherwise make a settings bundle
Try InAppSettingsKit, it will provide you a hybrid solution by maintaining the Settings.app pane.

How can I make my iOS apps talk to each other?

I’ve got several iOS apps and I need them to be aware of each other. More precisely, I need to know whether there’s already one of my apps installed.
I thought about registering a custom URL scheme (something like my-app-present://), so that I could check whether the custom scheme is supported and if yes, I would know there’s already one of my apps on the device. But that doesn’t work, because the schemes are registered through Info.plist and the app registers the scheme before it has a chance to check for its existence. In other words, the check always succeeds.
Then I thought about creating a file in the temporary directory, but NSTemporaryDirectory() returns a folder inside the application sandbox, so that wouldn’t work either. I also thought about keychain, but again it looks like each application has strictly separate keychain on iOS.
I don’t want to go through the list of running apps and I don’t want to use networking. Do you know some other tricks?
The custom URL scheme method sounds fine, as long as you have a different scheme for every app, for example my-app-1:// and my-app-2://. Then (I assume this is what you already knew) you can use canOpenURL: to check if the URL can be handled (i.e., your app is installed).
If by "talk to each other" you meant you just want to detect whether other app has been installed or not then iHasApp is an open source iOS framework could come in handy. I haven't used it yet. but from the description it appears to be a good choice.
http://www.ihasapp.com/documentation/Classes/iHasApp.html

how to share a certain directory tree list from <Application_Home>/Documents using UIFileSharingEnabled

i want to integrate itunes file sharing into my app. I know that i just need to set true UIFileSharingEnabled in info.plist. But it make all files and directories in /Documents from my app is show in itunes file sharing. I just want to share a directory tree listing in itunes file sharing.
This is a screenshoot of my /Documents (i got it from iphone simulator directory but it is same for the device)
from that pictures, i just want to share the all files in Project directory without showing Project directory itself.
Can i do that? Please help me to solve this.
Thank you, Risma
I don't think you can alter what is shared when you enable file sharing by using the UIFileSharingEnabled key in Info.plist.
However I suggest that you revamp your content so that application specific content go into the Library folder such as the database file and other non-user stuff. You might want to go through this for identifying which folders are backed up by iTunes.
How about a symbolic link? That would solve that issue in a snap, provided you can implement them and control permissions. Not sure how to do that with iOS, but it's definitely worth looking into. When it comes to file sharing, links are your best friend.
I don't have any experience with iPhone app dev, but I've done plenty of file share management in Linux. Hopefully it's not too different... But I have no idea what system calls are available to you with iPhones. If you find out, I'd enjoy knowing. Good luck!

Resources