【发布时间】:2015-08-12 09:40:12
【问题描述】:
我正在尝试使用 facebook SDK 的 Graph API 通过我的应用发布故事。 我已经在其 App 控制台上配置了动作、对象和故事,并实现了以下代码来实现相同的目的。
NSURL *imageURL = [NSURL URLWithString:@"https://fbstatic-a.akamaihd.net/images/devsite/attachment_blank.png"];
FBSDKSharePhoto *photo = [FBSDKSharePhoto photoWithImageURL:imageURL userGenerated:NO];
NSDictionary *properties = @{
@"og:type": @"abc-holdings:glc",
@"og:title": @"Sample GLC",
@"og:description": @"Test Geo",
@"og:url": @"http://samples.ogp.me/147425295593678",
@"og:image": @[photo],
@"abc-holdings:location:longitude":@(-58.381667),
@"abc-holdings:location:latitude":@(23.381667)
};
FBSDKShareOpenGraphObject *object = [FBSDKShareOpenGraphObject objectWithProperties:properties];
FBSDKShareOpenGraphAction *action = [FBSDKShareOpenGraphAction actionWithType:@"abc-holdings:has_a_glc" object:object key:@"glc"];
[action setString:@"true" forKey:@"fb:explicitly_shared"];
// Create the content
FBSDKShareOpenGraphContent *content = [[FBSDKShareOpenGraphContent alloc] init];
content.action = action;
content.previewPropertyName = @"glc";
// Share the content
FBSDKShareAPI *shareAPI = [[FBSDKShareAPI alloc] init];
shareAPI.shareContent = content;
shareAPI.delegate = self;
[shareAPI share];
但这个问题是它回应我如下
Error Domain=com.facebook.sdk.share Code=201 "The operation couldn’t be completed. (com.facebook.sdk.share error 201.)" UserInfo=0x7fb9e1749190 {com.facebook.sdk:FBSDKErrorDeveloperMessageKey=Error sharing Open Graph content, NSUnderlyingError=0x7fb9e14c5210 "The operation couldn’t be completed. (com.facebook.sdk.core error 8.)"}
有人对此有什么想法吗?
【问题讨论】:
-
这正是我遇到的问题......运气好解决了吗?
-
尝试将命名空间附加到
glc类型,看看是否有帮助。例如[ ... object:object key:@"abc-holdings:glc"]和content.previewPropertyName = @"abc-holdings:glc";.
标签: ios facebook facebook-graph-api facebook-ios-sdk