2010-04-15 101 views
4

我希望在下面列出什麼是.DS_Store

for(NSString *path in [manager contentsOfDirectoryAtPath:[self appDelegate].gCurrentPath_AppDelegate 
                 error:nil]) 
{ 

    NSDictionary *modData=[manager attributesOfItemAtPath: 
          [appDelegate.gCurrentPath_AppDelegate 
          stringByAppendingPathComponent:path ] 
                error:nil ]; 
    NSDate * dateModified=(NSDate *) [modData objectForKey:NSFileModificationDate]; 

    NSNumber *fileSize=[modData objectForKey:NSFileSize] ; 


    FileObj *newobj=[[FileObj alloc] init ]; 

    NSString *ss=[[NSString alloc] initWithFormat:@"%@",path] ; 
    [newobj setfileName:ss]; 
    [ss release]; 

    [ fileArray addObject:newobj];//fileArray: the data source of UITableView 
    [newobj release]; 
} 

我發現有在列表中的名稱」 .DS_Store」的文件中的代碼在文檔目錄中的所有文件。 我瀏覽模擬器目錄無法找到此文件的位置

回答

4

.DS_Store文件是由Mac OS X創建的文件,它包含有關目錄的元信息,您可以總是找到它並安全地忽略它。由Finder。

+2

另外,這個文件不會出現在iPhone設備上。在模擬器中測試時看到它的唯一原因是模擬器使用Mac OS X文件系統。 – Jasarien 2010-04-15 10:12:51

+0

可以刪除嗎? – Drewdin 2011-08-03 03:40:11

+0

@德魯丁:是的。 – 2011-08-03 04:06:14