2010-08-11 32 views

回答

5

你可以得到的文件目錄的位置,像這樣:

NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES); 
path = [paths objectAtIndex:0]; 

,然後簡單地打印目錄的內容到控制檯:

NSLog(@"%@", [[NSFileManager defaultManager] contentsOfDirectoryAtPath:path error:nil]); 

這裏的相關文件:http://developer.apple.com/iphone/library/documentation/Cocoa/Conceptual/LowLevelFileMgmt/Articles/StandardDirectories.html

+0

我的意思是,我們不能看到文件的硬拷貝,因爲我們可以看到模擬器? – ram 2010-08-11 09:39:17

+0

嘿在模擬器我可以看到icell, 名單, 「sample1.cfg」,但在iPhone上,我只能看到icell ..所以是錯誤的? – ram 2010-08-11 10:31:37

+0

我不確定你的意思。你的意思是你的設備上的Documents文件夾中缺少文件?你是指「查看文件的硬拷貝」是什麼意思?您無法像使用模擬器那樣真正到達Finder中的文件,如果這就是您的意思。 – 2010-08-11 16:55:51

相關問題