尋找沙箱的Documents文件夾路徑

 


// 尋找沙箱的Documents文件夾路徑

方法一:

- (NSString *) dataFilePath {

    

    NSArray *paths =NSSearchPathForDirectoriesInDomains(NSDocumentDirectory,NSUserDomainMask, YES);

    

    NSString *documentsDirectory = [paths objectAtIndex:0];

    

    return [documentsDirectorystringByAppendingPathComponent:@"test.txt"];

    

}

NSString * path = [self dataFilePath];

方法二:

- (NSString *) dataFilePath {

    

    NSString *homePath =NSHomeDirectory();

    stringByAppendingPathComponent

    return [homePath StringByAppendingPathComponent:@"Library/test.txt"];

    

}


發佈了74 篇原創文章 · 獲贊 3 · 訪問量 21萬+
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章