gpt4 book ai didi

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

转载 作者:行者123 更新时间:2023-11-28 21:42:22 25 4
gpt4 key购买 nike

我有一些文件想与任何应用程序共享。我用这个代码

var fileDAta = NSData.FromFile(path);

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

PresentViewController(activityViewController,true,null);

enter image description here

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

无论如何,当我选择邮件时,它无法附加..

enter image description here

我应该改变什么?

最佳答案

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];

关于ios - 通过我的 ios 应用程序与 UIActivityViewController 共享文件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31537311/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com