Getting a list of files in the Resources folder - iOS

前端 未结 7 2229
悲哀的现实
悲哀的现实 2020-11-28 19:52

Let\'s say I have a folder in my \"Resources\" folder of my iPhone application called \"Documents\".

Is there a way that I can get an array or some type of list of a

7条回答
  •  死守一世寂寞
    2020-11-28 20:36

    You can try this code also:

    NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
    NSString *documentsDirectory = [paths objectAtIndex:0];
    NSError * error;
    NSArray * directoryContents =  [[NSFileManager defaultManager]
                          contentsOfDirectoryAtPath:documentsDirectory error:&error];
    
    NSLog(@"directoryContents ====== %@",directoryContents);
    

提交回复
热议问题