我正在使用 ShareKit 将对象共享到 Twitter、Facebook 和电子邮件。Twitter 和 Facebook 运行良好,但电子邮件却不行。我真的不知道为什么。
似乎它的工作方式非常随机。
我是这样设置的:
[self.customView.shareButton addTarget:self action:@selector(sharePost:) forControlEvents:UIControlEventTouchUpInside];
- (void)sharePost:(UIButton *)sender
{
NSURL *url = [NSURL URLWithString:self.currentPost.link];
// Add image.
NSString *imageUrlString = [NSString stringWithFormat:[link]];
NSURL *imageUrl = [NSURL URLWithString:imageUrlString];
UIImageView *postImage = [[UIImageView alloc] init];
[postImage setImageWithURL:imageUrl];
SHKItem *item = [SHKItem image:postImage.image title:[NSString stringWithFormat:@"%@", self.currentPost.title]];
[item setURL:url];
[item setMailBody:[NSString stringWithFormat:@"%@ %@", self.currentPost.title, self.currentPost.link]];
// Get the ShareKit action sheet
// This works
SHKActionSheet *actionSheet = [SHKActionSheet actionSheetForItem:item];
// ShareKit detects top view controller (the one intended to present ShareKit UI) automatically,
// but sometimes it may not find one. To be safe, set it explicitly.
[SHK setRootViewController:self];
// Display the action sheet.
[actionSheet showInView:self.view];
}
有什么想法或我错过了什么或做错了什么?