How do I create new subdirectories/folders withing my app bundle during runtime?
-
20-09-2019 - |
Question
I am writing many files to disk, and I would like to split them up into different categories, but how do I do this?
Solution
See following methods in NSFileManager
class:
- (BOOL)createDirectoryAtPath:(NSString *)path attributes:(NSDictionary *)attributes
- (BOOL)createDirectoryAtPath:(NSString *)path withIntermediateDirectories:(BOOL)createIntermediates attributes:(NSDictionary *)attributes error:(NSError **)error
Note also that you cannot write anything into application bundle. Application sandbox however contains several folders where you can write (the choice between them depends on your needs). See "Commonly Used Directories" for more information.
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow