我正在尝试使用新的 SDK 发布这样的图形事件:
FBSDKAccessToken *token = [FBSDKAccessToken currentAccessToken];
FBSDKGraphRequestConnection *connection = [[FBSDKGraphRequestConnection alloc] init];
NSMutableDictionary<FBGraphObject> *action = [FBGraphObject graphObject];
action[@"event"] = @"http://samples.ogp.me/680289198752391";
FBSDKGraphRequest *request = [[FBSDKGraphRequest alloc] initWithGraphPath:@"me/friendlish:add" parameters:action tokenString:token.tokenString version:@"v2.3" HTTPMethod:@"POST"];
//
[connection addRequest:request completionHandler:^(FBSDKGraphRequestConnection *connection, id result, NSError *error) {
if(error)
NSLog(@"%@", error);
else
NSLog(@"%@", result);
}];
[connection start];
一切正常,它发布 - 但是当我尝试将示例实际更改为这样的自定义内容时:
NSMutableDictionary<FBGraphObject> *action = [FBGraphObject graphObject];
NSMutableDictionary<FBGraphObject> *event = [FBGraphObject openGraphObjectForPost];
event[@"og:title"] = @"My Event";
event[@"og:type"] = @"friendlish:event";
event[@"og:url"] = @"http://www.facebook.com";
event[@"og:description"] = @"Yaba daba doo";
event[@"og:image"] = @"https://fbstatic-a.akamaihd.net/images/devsite/attachment_blank.png";
action[@"event"] = event;
在调用连接 NSLogs 之前,我在控制台中收到第一个错误:
不支持的 FBSDKGraphRequest 附件:{ data = { }; "fbsdk:create_object" = 1; "og:description" = "Yaba daba doo"; "og:image" = " https://fbstatic-a.akamaihd.net/images/devsite/attachment_blank.png "; "og:title" = "我的活动"; "og:type" = "friendlish:event"; “og:url”=“ http://www.facebook.com ”;},跳过。
然后来自连接方法NSLog的错误:
错误域=NSURLErrorDomain 代码=-1002“不支持的 URL”UserInfo=0x174077080 {NSLocalizedDescription=不支持的 URL,NSUnderlyingError=0x17445f920“不支持的 URL”}