Reputation: 897
I want to know whether I can access the directory where my application is installed. Also I want to create a sub directory in the same directory to store all the images I capture in my application. I further want to view the images using iPhone's default image viewer. Can this be done?
Upvotes: 6
Views: 40277
Reputation: 26812
If you want to access the app on the simulator, navigate to this directory:
~/Library/Application Support/iPhone Simulator/User/Applications
If you want to access the app on a device it gets a little trickier. First, plug your iOS device into iTunes and backup the phone (with encryption turned off). Then download this app: iPhone / iPod Touch Backup Extractor, find your bundle ID and click extract. The app will then get all the data for you to see. Sure it's not real time but does the job!
Upvotes: 4
Reputation: 1682
To store any files of your own, you'll have to use the Documents directory as Girish already said. But if you need to display images that you captured using the camera, the only way you can display them with UIImagePickerController (the default image viewer) is by specifying the source type when initializing it as the saved photos album.
Upvotes: 0
Reputation: 2515
You can get the Document folder of the app
NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
NSString *documentsDirectory = [paths objectAtIndex:0]; // Get documents folder
You can create Folder and files using NSFileManger. You can store files in document folder or even you can store it in temp folder.
Upvotes: 8
Reputation: 11
~/Library/Application Support/iPhone Simulator/User/Applications link text
Upvotes: 1
Reputation: 12177
C'mon, this is all in the sample code and documentation. In fact, it's even one of the Frequently Asked Questions in the iPhone Dev Center. I refuse to give the answer. Instead, here's a link: Easily found documentation that answers your question
Upvotes: -11
Reputation: 5283
NSString *appFolderPath = [[NSBundle mainBundle] resourcePath];
NSFileManager *fileManager = [NSFileManager defaultManager];
NSLog(@"App Directory is: %@", appFolderPath);
NSLog(@"Directory Contents:\n%@", [fileManager directoryContentsAtPath: appFolderPath]);
Upvotes: 14