gpt4 book ai didi

ios - 是否可以使用 UIActivityViewController 将 Instagram Action 添加到事件表?

转载 作者:行者123 更新时间:2023-12-01 16:28:40 25 4
gpt4 key购买 nike

我正在创建一个 iOS 应用程序,它使用户能够将图像发布到三个(或所有三个)社交媒体提供商之一,包括:Twitter、Facebook 和 Instagram。

我已经尝试使用 UIDocumentInteractionController() 实现此功能,虽然这在添加“复制到 Instagram”图标选项方面很有效,但它不允许我为 Facebook 和 Twitter 共享添加图标/选项。

花了一个小时左右的时间在谷歌上搜索我的问题的解决方案后,我遇到了看起来很有希望的 UIActivityViewController 。我已经实现了一个事件表,它允许我通过 Facebook 和 Twitter 分享这很棒,但是,有人知道我如何将“复制到 instagram”选项集成到表中吗?

    @IBAction func shareInstagramPressed(sender: AnyObject) {
if(newImageData.length != 0){
let image = UIImage(data:newImageData, scale:1.0)
displayShareSheet(image!)
}
else {
print("Please select an image first")
}
}

func displayShareSheet(shareContent:UIImage) {
let activityViewController = UIActivityViewController(activityItems: [shareContent as UIImage], applicationActivities: nil)
activityViewController.excludedActivityTypes = [
UIActivityTypePostToWeibo,
UIActivityTypePrint,
UIActivityTypeAssignToContact,
UIActivityTypeAddToReadingList,
UIActivityTypePostToVimeo,
UIActivityTypePostToTencentWeibo,
UIActivityTypeOpenInIBooks,
UIActivityTypeMessage,
UIActivityTypeMail
]
presentViewController(activityViewController, animated: true, completion: {})
}

最佳答案

是:

...技术上是可能的,但这种支持应该可能来自 Instagram。

来自Apple Documentation :

You should subclass UIActivity only if you want to provide custom services to the user. The system already provides support for many standard services and makes them available through the UIActivityViewController object. For example, the standard activity view controller supports emailing data, posting items to one of the user’s social media accounts, and several other options. You do not have to provide custom services for any of the built-in types.

否:

Instagram 当前不支持 UIActivity

来自Instagram Documentation :

NSURL *instagramURL = [NSURL URLWithString:@"instagram://location?id=1"];
if ([[UIApplication sharedApplication] canOpenURL:instagramURL]) {
[[UIApplication sharedApplication] openURL:instagramURL];
}

关于ios - 是否可以使用 UIActivityViewController 将 Instagram Action 添加到事件表?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33585701/

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