How safe is to store files into the document directory? - ios

I am writing an iOS app in Swift and Xcode where I allow users to download some files from a server and to store them into the iPhone's document directory.
How safe is it to do so?
Is it possible for a user to access one of these files from outside the app, for example by connecting their phone to a computer, and move them around or share them? If a user has a jailbroken iPhone, could he get a way to access the downloaded files in other ways other than the one I allow within my app?
And if so, should I encrypt my files when I download them?

For jailbroken iPhone i think yes it's possible to access apps directories.
For normal iPhone I'm pretty sure other apps can't access it as all third-party apps are “sandboxed"
https://support.apple.com/en-gb/guide/security/sec15bfe098e/web#:~:text=Sandboxing,information%20stored%20by%20other%20apps.
And no idea about connecting their phone to a computer.

Related

How safe is Application Support folder?

Can iOS users access an app's Application Support folder? How safe is this folder?
I'm facing a dilemma between these two options:
Decrypt content (classified as Intellectual Property) and save it in app's Application Support folder in advance when app is installed to get better viewing speeds later;
Keep it encrypted and safe but sacrifice speed.
How safe is the app's Application Support folder? App by the way is coded in Objective C.
No folder is "safe". There are simple apps that let users extract the contents of their device backups made with iTunes. This means that it's trivial to see any file stored by any app on their device.
And there are countless ways to browse an iOS device's files if the iOS device is jailbroken.
So really there is no "safe" folder you can choose to really hide content from a user if the user has the slightest technical ability.
Same for any files bundled in an app. A user can unzip the ipa of any app they've ever installed on any of their iOS devices. All of the ipas are stored on their computer when they backup their device via iTunes.

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 :)

Access to Application Support Directory on the device during development

One can physically access to the app's Document Directory on the device using iTunes File Sharing. What about the Application Support Directory? (The same way if the app is on the simulator)
Anyway one can do this?
Take a look at http://developer.apple.com/library/mac/#recipes/xcode_help-devices_organizer/articles/copy_app_data_from_sandbox.html
This should provide you with a package of all data within the App's sandbox

How can I export an iPad app's data to a computer?

I have a simple survey iPad app. The data is saved in a TSV (tab separated file). I'm looking for an easy way to export this TSV file to a computer (without emailing it, if possible, and without doing it through iTunes).
App data on iOS is not directly accessible from a connected computer. It's not like you can mount the iPad's flash drive directly on a computer, navigate to the app's data directory, and copy the file to the computer. You have to have something with rights to access the data.
Some options are:
email or otherwise 'share' the data from within the iPad app.
Make the app's data accessible via iTunes
Turn the app into an FTP client or server
Dropbox integration (There was some problem where Apple was rejecting apps that did this, but i don't know the current state)
Have a look at IExplorer. It's a great little program / app that let's you access your iPad's file system from your computer. You can just drag and drop any file from your iPad to your computer.

What is the best way to access iOS filesystem from an app?

I'll be working on a cryptographic app for iPad soon. Along to some other features, I'd like to be able to get documents within the iPad's file system to work with them.
So far, I haven't experimented with that, but I've seen apps such as pdf readers that don't share their files with other apps and can't reach files belonging to other apps. Is it possible -and legal- to reach all the files in the iPad from an app?
Thank you very much!
No. This is not possible unless you Jailbreak your device. All applications are sandboxed and can only access files they are in the their individual sandbox.

Resources