【发布时间】:2019-01-17 23:10:22
【问题描述】:
我需要使用默认阅读器打开一个 pdf 文件,android 可以,但对于 iOS,我不能。而且我没有扎实的C#经验只有2个月
public void SaveOpen(string filename, MemoryStream stream)
{
string path = Environment.GetFolderPath(Environment.SpecialFolder.Personal);
string filePath = Path.Combine(path, filename);
//Create a file and write the stream into it.
FileStream fileStream = File.Open(filePath, FileMode.Create);
stream.Position = 0;
stream.CopyTo(fileStream);
fileStream.Flush();
fileStream.Close();
UIViewController currentController = UIApplication.SharedApplication.KeyWindow.RootViewController;
while (currentController.PresentedViewController != null)
currentController = currentController.PresentedViewController;
UIView currentView = currentController.View;
}
【问题讨论】:
-
你不能在 webview 上加载它吗?必须是默认应用?
-
是的,应该是@BrunoCaceiro
-
@BrunoCaceiro já vi que és Portugues e acho que podemos falar portugues。 Sim eu preciso abrir com um leitor padrão, e no android eu consigo baixar um arquivo pdf e abrir logo e já no iOS nao abri。
-
我们需要说英语。你遇到了什么错误?
-
我看不到pdf,它没有显示任何错误@Bruno