【发布时间】:2020-02-02 23:28:23
【问题描述】:
我使用 UIDocumentInteractionController 在应用程序中预览不同类型的文件。这在过去运行良好,但在装有 iOS 13 的设备上运行应用程序时,不会显示文档。显示的是文件名和类型。
我已经寻找了类似的问题并找到了这个 UIDocumentInteractionController showing file name and file type , not file contents
我已尝试NSUrl.CreateFileUrl(FilePath, null),正如该问题上的 cmets 所建议的那样,但这并不能解决问题。
这是我用来打开文件和呈现预览的:
var uidic = UIDocumentInteractionController.FromUrl(new NSUrl(FilePath, true));
uidic.Delegate = new DocInteractionC(navcontroller);
uidic.PresentPreview(true);
以及控制器定义:
public class DocInteractionC : UIDocumentInteractionControllerDelegate
{
readonly UIViewController m_oParentViewController;
public DocInteractionC(UIViewController controller)
{
m_oParentViewController = controller;
}
public override UIViewController ViewControllerForPreview(UIDocumentInteractionController controller)
{
return m_oParentViewController;
}
public override UIView ViewForPreview(UIDocumentInteractionController controller)
{
return m_oParentViewController.View;
}
}
这可能是适用于 iOS 13 的 Xamarin.ios 中的 NSUrl 的问题吗?任何帮助将不胜感激。
【问题讨论】:
-
它在真实设备上工作但在模拟器中出现错误?如果是这样,您是否可以在模拟器中登录 iCloud 无法通过 Files 应用访问 iCloud Drive?
-
问题出现在真正的 iOS 13 设备上,虽然我无法调试运行 iOS 13 的设备,我只有一个 iOS 12 设备,但我得到了与报告的相同的行为在 iOS 13 模拟器中。
-
文件似乎没有被正确识别。如果我打开一个 XLSX 文件并按下右上角的共享按钮,它不会将 Numbers 或 Excel 显示为可能的共享目标。
标签: xamarin xamarin.ios nsurl ios13 uidocumentinteractioncontroller