How can i browse a text file in iphone - iphone

How can i browse a text file in iPhone ?.
I used UIImagePickerController, but can only browse in photo library, but i want to browse whole phone memory just like asp:fileupload.
Thanks.

You can however browse files in your app's own documents folder, by retrieving directory listings via the NSFileManager. You can't however browse the directories holding files for other apps. This is due to Apple's sandboxing of apps for security.

Related

Create folder on iCloud from iPhone App

I am developing an iPhone app were I want to create a folder from my application on iCloud.
Is it possible to create folder on iCloud programmatically at all?
I want to add image files, text files and audio files in that folder.
Thanks.
Sure you can create folders. When you call [fileManager URLForUbiquityContainerIdentifier:] you get back a file URL for your container and you can put any file hierarchy in there you please.
Sounds like you're just getting started so I suggest you start with Apple's iCloud for Developers Documentation and Videos. Specifically you will want the Advanced iCloud Document Storage video as you'll want more control than CoreData and UIDocument will provide. Apple refers to this this type of iCloud storage as a "Shoebox App".

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

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

iPhone: retrieve contents of "documents" directory

Are there any development tools to access contents of the "documents" directory on iPhone?
I'd like to access SQLITE database that was created by my application in order to fix some bugs.
Thanks.
In Xcode, pull up Window>Organizer. Click on your phone. In the list of applications, for your applications (that you installed with Xcode) there will be a "download" button available that will pull the entire home directory for the app.