iPhone初心者ですが、
私は本をダウンロードし、それを という名前のフォルダーに保存するアプリを作成しましbook1Folder
たDocument directory
。
今、配列内のすべての書籍の名前が必要です。内部には 2 つの書籍がありますが、book1Folder
このコードを記述すると、配列の数が 3 であることがわかります。
これが私のコードスニペットです。
-(void)viewWillAppear:(BOOL)animated{
NSString *files;
NSString *Dir=[self applicationDocumentsDirectory];
Dir=[Dir stringByAppendingPathComponent:@"book1Folder"];
NSDirectoryEnumerator *direnum = [[NSFileManager defaultManager] enumeratorAtPath:Dir];
Downloadedepubs = [[NSMutableArray alloc]init];
while(files = [direnum nextObject])
{
if([[files pathExtension] isEqualToString:@"epub"])
NSLog(@"files=%@",files);
[Downloadedepubs addObject:files];
}
}
私のログには 2 本の名前しか表示されませんが、配列をループすると 3 つのオブジェクトが含まれます。
[Downloadedepubs ObjectAtIndex:0]=.DS_Store;
[Downloadedepubs ObjectAtIndex:1]=abcd;
[Downloadedepubs ObjectAtIndex:2]=pqrs;
.DS_Store
それが来る理由は何ですか?
どんな助けでも大歓迎です。