简体   繁体   English

使用Xamarin.iOS访问iOS 8中的tmp目录

[英]Access tmp directory in iOS 8 with Xamarin.iOS

有谁知道如何使用Xamarin在iOS 8中获取tmp目录的路径?

Just try: 你试一试:

var documents = NSFileManager.DefaultManager
    .GetUrls(NSSearchPathDirectory.DocumentDirectory, NSSearchPathDomain.User)[0].Path;

var tmp = Path.Combine(documents, "../", "tmp");

You can just use 你可以用

var tmp = System.IO.Path.GetTempPath ();

This will return your app's tmp directory 这将返回您应用的tmp目录

//https://developer.xamarin.com/guides/ios/application_fundamentals/working_with_the_file_system
public string TempPath()
{           
    var documents = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments);
    var ret = Path.Combine(documents, "..", "tmp");
    return ret;
}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM