2013-12-11 61 views

回答

10
var docsPath = Environment.GetFolderPath (Environment.SpecialFolder.MyDocuments); 
var libPath = Path.Combine (docsPath, "..", "Library"); 
+0

如果Apple明天更改了Library文件夾的位置,那麼......? – Krumelur

+5

然後,每個應用程序都將被破壞,因爲Apple將此文檔記錄下來,並且不提供API來檢索目錄。 https://developer.apple.com/library/ios/documentation/FileManagement/Conceptual/FileSystemProgrammingGuide/FileSystemOverview/FileSystemOverview.html – poupou

+0

我認爲iOS 8已經改變了這一點。有沒有人有這個更新? – Lereveme

4

在iOS8上我用這個和它的工作:

NSFileManager.DefaultManager.GetUrls (NSSearchPathDirectory.LibraryDirectory, NSSearchPathDomain.User) [0].Path 

我得到這個從Xamarin的page about the iOS file system。它說「iOS 8注意:本文檔的部分內容受到iOS 8更改的影響。如果您的應用程序使用Environment.SpecialFolder或計算相關路徑(如」../Documents「),則應閱讀Apple的技術說明。 iOS文件系統基礎知識「。

+0

我在你分享的鏈接上找不到這段代碼。另外你的解釋是真的vage。我無法理解它。 – Dpedrinha

相關問題