通过我的 ios 应用程序与 UIActivityViewController 共享文件

Sharing a file through my ios Application with UIActivityViewController

我有一些文件想要与任何应用程序共享。我使用此代码

var fileDAta = NSData.FromFile(path);

UIActivityViewController activityViewController = new UIActivityViewController
                        (new NSObject[]{ fileDAta }, null); //(items, null);

PresentViewController(activityViewController,true,null);

如您所见,它应该是更多的应用程序,但默认情况下,只有邮件应用程序。真机也是一样的。(我也安装了Gmail和Outlook,但是没有在列表中,也没有在更多列表中)

无论如何,当我select邮件时,无法附加..

我应该改变什么?

Use the following code for sharing but remember respective applications(gmail,twitter etc) for sharing must be installed on your device and configured.

 UIActivityViewController *activityVC = [[UIActivityViewController alloc] initWithActivityItems: fileDAta applicationActivities:nil];
activityVC.excludedActivityTypes = @[UIActivityTypePrint, UIActivityTypeCopyToPasteboard, UIActivityTypeAssignToContact, UIActivityTypeSaveToCameraRoll]; //or whichever you don't need
[self presentViewController:activityVC animated:YES completion:nil];