【发布时间】:2018-06-10 11:06:14
【问题描述】:
我正在尝试在 C# 中实现服务,该服务允许我将字符串共享给我的 iOS 系统中的现有应用程序(例如,使用我的字符串文本或短信应用程序启动电子邮件应用程序)。为此,我已经实现了应该这样做的类。代码如下:
public class IphoneShareService : IShareService
{
public void Share(string content)
{
var text = NSObject.FromObject(content);
var items = new[] { text };
var activity = new UIActivityViewController(items, null);
UIApplication.SharedApplication.KeyWindow.RootViewController.PresentViewController(activity, true, null);
}
}
问题是,当我使用参数(字符串)调用 PresentViewController 方法时,我没有任何选项可以发送文本。这是在我的应用程序中调用 PresentViewController 后的示例截图:
所以我不知道实际上是什么问题?我需要设置一些特殊代码来标记我的 PresentViewController 以显示可以共享我的文本的指定应用程序?
【问题讨论】:
标签: xamarin xamarin.ios mvvmcross