UIDocumentInteractionController在iOS6但不在iOS5中工作
问题描述:
我在MonoTouch和iOS6模拟器中使用UIDocumentInteractionController,在iOS6设备上使用我的代码一半工作。然而,它不适用于iOS5模拟器/设备。这是我在示例项目中测试的示例类。UIDocumentInteractionController在iOS6但不在iOS5中工作
using System;
using MonoTouch.UIKit;
using MonoTouch.Foundation;
namespace DocumentThing
{
public class MyViewController : UIViewController
{
UIDocumentInteractionController documentInteractionController1;
UIDocumentInteractionController documentInteractionController2;
UIBarButtonItem leftButton;
UIBarButtonItem rightButton;
public MyViewController()
{
}
public override void ViewDidLoad()
{
View.BackgroundColor = UIColor.White;
leftButton = new UIBarButtonItem(UIBarButtonSystemItem.Action, null, null);
leftButton.Clicked += delegate(object sender, EventArgs e)
{
InvokeOnMainThread(delegate {
documentInteractionController1 = new UIDocumentInteractionController();
documentInteractionController1.Url = NSUrl.FromFilename(@"testpdf.pdf");
documentInteractionController1.PresentOpenInMenu(View.Frame, View, true);
});
};
NavigationItem.LeftBarButtonItem = leftButton;
rightButton = new UIBarButtonItem(UIBarButtonSystemItem.Action, null, null);
rightButton.Clicked += delegate(object sender, EventArgs e)
{
InvokeOnMainThread(delegate {
documentInteractionController2 = new UIDocumentInteractionController();
documentInteractionController2.Url = NSUrl.FromFilename(@"testpdf.pdf");
documentInteractionController2.PresentOptionsMenu(View.Frame, View, true);
});
};
NavigationItem.RightBarButtonItem = rightButton;
}
}
}
的PresentOptionsMenu工作正常,在iOS6的但不是在iOS5中,和PresentOptionInMenu双方的iOS5和iOS6的失败。不确定这是否是iOS5/6 SDK /模拟器的错误,或者是否是MonoTouch中的错误。我不知道如何进一步调试此问题...
建议?
答
回答我的问题...
你检查,如果你有任何事,打开设备上的PDF具有iOS5的对吗?不要忘记iBooks默认不安装,iOS不认为使用Safari作为PDF阅读器。
不,我没有检查!在设备上安装了iBooks,我现在可以在iBooks中打开它!这使得很多感觉! –