iOS - How to locate all files on my IPad/IPhone through Objective-C - iphone

I am writing an App that will allow users to browse through all files of a certain extension (say PDF, XLS) on my IPhone/IPad. The App will then upload the file to a server.
The App should be able to locate files which are not located in its sandbox directories.
How can this be done in Objective-C?
Thanks a lot.

This is not possible. Your app cannot access files or directories outside of its sandbox.

You can enable users to open documents from other applications into your application and then send them to the server. In the application, you must specify what type of documents you want to open (UTI).

You can't do this. Your app can only access files inside its sandbox directory unless the device is jailbroken. If your app even attempts to read files outside of the sandbox, it will be rejected from the App Store.

Related

iPhone : Browse documents

I have searched a little about file browsing on iPhone and i'd like to confirm some of my conclusions :
an App can't browse files outside its sandbox. Examples : no app can browse the files inside 'iBooks','voice Memos', 'Notes' ..etc. One exception however: the 'Photos' app sandbox is browsable through UIImagePickerController.
browsing an app's directory from itunes is possible if File-Sharing is enabled (UIFileSharingEnabled).
Thanks in advance for your replies.
Correct. :) Easiest response ever!
Well, to clarify, the directory browsable in iTunes with UIFileSharingEnabled is specifically your app's ~/Documents directory. (You can make use of other directories with particular functionality, like ~/Library/Caches, which is ignored by iCloud backups and subject to deletion when the device is low on storage.)

Transfer file from Mac/PC to iPhone App Document folder

I want to transfer file from system (mac/Pc), which is present on my iPhone wifi network, to the document folder of my iPhone App.The scenario of my App is this, it will browse the system which are present in it's network. select any file(such as .pdf or ,docx) from that system(mac/Pc), copy it into the document folder of the APP and than use it with in the APP.During my search i come across the link iPhone : Transfer of files from Mac/Pc to app i have not found the detail instruction document, how to use it. Is Apple support any API or farm work to do this ? Please guide me
This is called iTunes file sharing. In the most simple way, you simply set the UIFileSharingEnabled key in your Info.plist file to YES. See for example this tutorial.
Rewriting itunes is not a simple task but I recommend you a clever and easier solution:
Implement a simple webserver on your iOS app. Write a windows application which will connect to your iOS app through wifi network. Then transfer the necessary files this way: you will send a file to you app, then your app should save it in documents directory.

Downloading files for UIWebView to specific folder on IPhone

I have made an app that displays my website from a UIWebView and it takes you to a store that you can download files. My question is that I need to download a '.zip'file from my website using the app to the IPhone. Heres is my problem. I don't want the file to goto the App's Document folder, I want it to goto a folder that is outside of my applications folder. Here is an example path I might want my file to goto EX:'var/mobile/Library/Downloads'. If there is not a way to download the files to a path outside of the app's folder, is there a way to transfer the specific file that I have downloaded from my website using the my app to another folder that is not located in my app's folders? I know this can be done because I have used apps that have done this, of course they were apps only available on Cydia. This is also an app that will be used for Jail-broken users just for your information!
Thanks for any help!
Any "regular" iphone app runs in a sandbox that prevents access to system wide directories. Practically, you only have access to the app Home Directory.
Unless you go for a jailbroken app, you have no other options than storing to the App docs folder.
Read "The Application Sandbox" and "The File System" [here] for more details1.
EDIT:
I am not an expert on cydia, but the general idea is gaining access as root and then write to where you need to. This can be done by replacing your app with a suid shell script that will in turn exec your app (which will have root privileges now and then be able to go out of the sandbox).
For more info look at this.

How to protect personal documents in my app for the maximum

I want to protect the user's document downloaded via my app.
- If I store the files in Document folder of iOS, iTunes will read them, right?
- If I store the files in Library or a subdirectory of it, files will be cleaned when the app is upgraded?
- The NSFileManager has a NSFileProtectionKey property. But I'm not sure what exactly it can do to protect the files? Does it can prevent other app from reading the user's files?
Overall, I want the files only can be read in my application, other than iTunes or other jailbreak app.
Thanks alot.
Every app is in a SandBox. It means other apps can't access your app files, even from low-level functions.
So they are quite secure.
You can actually see this with this little app, available from the AppStore:
http://www.eosgarden.com/en/freeware/filesystem/
Apps are located in /var/mobile

How to retrive Core Data SQL store from Developer's App on the Developer's iPhone

I need a copy of the store that is saved as Core Data sqlite file inside a test app installed on my device.
I know how to get files out of the the simulator at path: ~/Library/Application Support/iPhone Simulator/[Version]/Applications/[AppID]/Documents
...but i need get the .sqlite file from the app on the device itself.
Unless the app itself has file sharing built in, you can't access the documents folder from outside the app. It is a security precaution and part of the sandbox.
Update:
I misunderstood the context of the question. To get files off a developers iPhone, connect the device and open Xcode>Window>Organizer. Select the device in the lefthand pane. In the righthand pane will be a list of applications. Your custom apps will have an arrow next to it. Hit the arrow and you will see "Application Data" hit the down arrow icon and it will let you download the data to folder. That folder will contain the apps Document, Library and tmp folders.
I wrote an application specifically for this to distribute to my customers and testers of my applications when they have problems. iPhoneRescue is free and allows you to get at all of the backup information in your iPhone; this includes any sqlite files.
All the users have to do is find their device backup, find the application, and then save the application files or just a specific file. (This does not work if they have encrypted their backups).