Xamarin.ios 使用PDFView从web显示PDF

Xamarin.ios 使用PDFView从web显示PDF,xamarin.ios,pdfview,Xamarin.ios,Pdfview,我有一个pdf,我正在从api下载到本地设备,并试图使用PDFView,因为我试图不使用webview进行任何操作 我的问题是,当我进入PDFView部分时,我将遵循教程。我被PDF文档卡住了。它一直说路径为空 var downloadPath=Path.Combine(FileSystem.CacheDirectory,“certificate.pdf”); var pdfView=新pdfView { TranslatesAutoresizingMaskIntoConstraints=fal

我有一个pdf,我正在从api下载到本地设备,并试图使用PDFView,因为我试图不使用webview进行任何操作

我的问题是,当我进入PDFView部分时,我将遵循教程。我被PDF文档卡住了。它一直说路径为空

var downloadPath=Path.Combine(FileSystem.CacheDirectory,“certificate.pdf”);
var pdfView=新pdfView
{
TranslatesAutoresizingMaskIntoConstraints=false
};
View.AddSubview(pdfView);
pdfView.LeadingAnchor.ConstraintEqualTo(View.SafeAreaLayoutGuide.LeadingAnchor).Active=true;
pdfView.TrailingAnchor.ConstraintEqualTo(View.SafeAreaLayoutGuide.TrailingAnchor).Active=true;
pdfView.TopAnchor.ConstraintEqualTo(View.SafeAreaLayoutGuide.TopAnchor).Active=true;
pdfView.BottomAnchor.ConstraintEqualTo(View.SafeAreaLayoutGuide.BottomAnchor).Active=true;
// ... HttpClient调用下载pdf。。。
pdfView.Document=新的PdfDocument(新的NSUrl(_downloadPath));

我排除了http客户端,因为它可以正常工作。没有问题,我可以在测试文件时检测到它。

这一行肯定有问题,我认为应该是:

pdfView.Document = new PdfDocument(new NSUrl(_downloadPath, false));

请尝试
NSUrl.FromFilename()
就是这样,谢谢您的帮助