利用create groups for any added folders 這樣的方式表示的是將所有的資源都放在資源套件得路徑下,沒有層次的概念
利用create folder references for any added folders這樣的表示方式是在按照原來檔案夾的方式將他們放入到安裝包中的。
在安裝包中有幾個這樣的檔案夾:(這些檔案都是位於家路徑下的)
(1)Documents: 該檔案夾用於程式資料檔案寫入到該目錄下,用於儲存使用者資料以及需要備份的資料。
(2)Library:include Caches and Preferences .
Preferences:用於放置使用者的偏好資料,你不能直接建立偏好的設定檔案,應該使用NSUserDefaults的類來擷取和設定應用程式偏好
Caches:用於存放應用程式專用的支援檔案,儲存應用程式再次啟動過程需要的資訊。
(3)tmp:臨時檔案夾,下次啟動就會將該檔案夾中的東西刪除。
擷取目錄的方法:
(1)擷取家目錄的方法:
NSString *homeDir = NSHomeDirectory();
(2)擷取Documents目錄路徑的方法:
NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
NSString *docDir = [paths objectAtIndex:0];
(3)擷取Caches目錄路徑的方法:
NSArray *paths = NSSearchPathForDirectoriesInDomains(NSCachesDirectory, NSUserDomainMask, YES);
NSString *cachesDir = [paths objectAtIndex:0];
(4)擷取tmp目錄路徑的方法:
NSString *tmpDir = NSTemporaryDirectory();
(5)擷取應用程式程式包中資源檔路徑的方法(擷取apple.png);
NSString *imagePath = [[NSBundle mainBundle] pathForResource:@"apple" ofType:@"png"];