gpt4 book ai didi

ios - 在 Facebook Messenger 的 UIActivityViewController 中发送图片 + url

转载 作者:IT王子 更新时间:2023-10-29 08:01:41 25 4
gpt4 key购买 nike

使用简单的 UIActivityViewController

-(void)share{

NSString *textToShare = _mytext;
NSURL *url = [NSURL URLWithString:@"http://www.google.com"];
UIImage *imageToShare = _myimage;
NSArray *activityItems = @[textToShare, url, imageToShare];
UIActivityViewController *activityVC =
[[UIActivityViewController alloc] initWithActivityItems:activityItems
applicationActivities:nil];

[self presentViewController:activityVC animated:YES completion:nil];
}

我想在适当的时候分享文字、网址和图片。

因此,如果用户选择邮件,则会显示所有内容。与其他应用程序(pinterest、facebook、twitter)等

在 Facebook Messenger 上 - 如果共享 url 和图像,共享屏幕会崩溃。这是一个已知问题吗(无法发送带有 URL 的图像)?

最佳答案

* 编辑:更新到最新的 SDK

FBSDKShareLinkContent *content = [[FBSDKShareLinkContent alloc] init];
content.contentTitle = @"Your title";
content.contentDescription = @"Some description text maybe...";
content.contentURL = [NSURL URLWithString:@"http://yourlink.com"];
content.imageURL = [NSURL URLWithString:@"http://yourlink.com/theImage.png"];

[FBSDKMessageDialog showWithContent:content delegate:self];


// Delegate
- (void)sharer: (id<FBSDKSharing>)sharer didCompleteWithResults: (NSDictionary *)results
{
BOOL complete = [[results valueForKeyPath:@"didComplete"] boolValue];
NSString *completionGesture = [results valueForKeyPath:@"completionGesture"];
if (completionGesture && [completionGesture isEqualToString:@"cancel"]) {
// action was canceled by the user
}

if (complete) {
// the message/link/image was sent
}
}

- (void) sharer:(id<FBSDKSharing>)sharer didFailWithError:(NSError *)error
{
// handle error...
}

你可以试一试:)

关于ios - 在 Facebook Messenger 的 UIActivityViewController 中发送图片 + url,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30302481/

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