This code is a part of Core Data. The URLsForDirectory....method does not run on iOS < 4 so I need to know some other methods/objects to call. I would also appriciate documentation for future reference. Thank you
/** Returns the URL to the application's Documents directory. */ - (NSURL *)applicationDocumentsDirectory { return [[[NSFileManager defaultManager] URLsForDirectory:NSDocumentDirectory inDomains:NSUserDomainMask] lastObject]; }
Tap Browse at the bottom of the screen, then tap an item on the Browse screen. If you don't see the Browse screen, tap Browse again. To view recently opened files, tap Recents at the bottom of the screen. To open a file, location, or folder, tap it.
Every iOS app gets a slice of storage just for itself, meaning that you can read and write your app's files there without worrying about colliding with other apps. This is called the user's documents directory, and it's exposed both in code (as you'll see in a moment) and also through iTunes file sharing.
The Document Directory is a tab to house supporting documentation for your accreditation or program review reports. There is on Directory per collection of reports, and this documentation can be used across all requirements/standards in within the particular collection.
Do a print(path. absoluteString) and then $ open path in Terminal, to open the file or folder at path. Keep in mind that the directory (on your Mac) where a Simulator's files are stored can change between running your app.
An alternative solution would be to use the -[NSFileManager URLsForDirectory:inDomains:]
method and fetching the path from the returned NSArray:
Objective-C:
NSArray *paths = [[NSFileManager defaultManager] URLsForDirectory:NSDocumentDirectory inDomains:NSUserDomainMask]; NSURL *documentsURL = [paths lastObject];
Swift:
let paths = NSFileManager.defaultManager().URLsForDirectory(.DocumentDirectory, inDomains: .UserDomainMask) let documentsURL = paths[0] as! NSURL
This is supported in iOS 4.0+
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With