iOS Facebook 分享
<p><p>在获得grantedPermissions“publish_actions”之后,现在我希望用户希望用户在不离开当前 View 的情况下将消息和图像(本地生成)发送到他们的Facebook时间线。</p>
<p>我试过<strong>FBSDKShareAPI</strong>接口(interface),但这不是我想要的效果。我希望用一个消息和一个图像来实现一个状态。我该怎么办?</p>
<pre><code>FBSDKSharePhoto* photo = [init];
photo.image = self.shareImage;
photo.userGenerated = YES;
FBSDKSharePhotoContent * content = [init];
content.photos = @;
if ([.permissions containsObject:@"publish_actions"]) {
FBSDKShareAPI * shareApi = [init];
shareApi.message = self.tf.text;
;
;
;
}
</code></pre></p>
<br><hr><h1><strong>Best Answer-推荐答案</ strong></h1><br>
<p><p>您分享了两次相同的内容,这可能是您无法通过一张图片(而是获得两张)获得一条状态消息的原因:</p>
<pre><code>;
;
</code></pre>
<p>您可能不需要为此创建一个开放的图形对象。试试这个:</p>
<pre><code>NSURL *imageURL = ;
UIImage *image = ]; // taking image from Wikipedia for example purposes
FBSDKSharePhoto *photo = [ init];
photo.image = image; // photo.image = self.shareImage;
photo.userGenerated = YES;
FBSDKSharePhotoContent *content = [ init];
content.photos = @;
if ([.permissions containsObject:@"publish_actions"]) {
FBSDKShareAPI * shareApi = [init];
shareApi.message = @"Lorem Ipsum Dolor Sit Amet"; // shareApi.message = self.tf.text;
shareApi.shareContent = content;
;
}
</code></pre></p>
<p style="font-size: 20px;">关于iOS Facebook 分享,我们在Stack Overflow上找到一个类似的问题:
<a href="https://stackoverflow.com/questions/31313416/" rel="noreferrer noopener nofollow" style="color: red;">
https://stackoverflow.com/questions/31313416/
</a>
</p>
页:
[1]