1
我只是試圖使用iOS SDK /新圖向Facebook發佈動作。通過新圖發佈Facebook動作
Problem is I keep getting an alert saying 'Action Requires at Least One Reference' It's invalid because it does not specify any reference objects. At least one of the following properties must be specified: event, friend, favorite, reminder.
這裏是我當前的代碼:
FBSDKAccessToken *token = [FBSDKAccessToken currentAccessToken];
FBSDKGraphRequestConnection *connection = [[FBSDKGraphRequestConnection alloc] init];
NSMutableDictionary<FBGraphObject> *action = [FBGraphObject graphObject];
NSMutableDictionary<FBGraphObject> *course = [FBGraphObject openGraphObjectForPost];
course[@"og:title"] = @"My Event";
course[@"og:type"] = @"myEventApp:event";
course[@"og:url"] = [NSURL URLWithString:@"http://www.facebook.com"];
course[@"og:description"] = @"Yaba daba doo";
action[@"course"] = course;
FBSDKGraphRequest *request = [[FBSDKGraphRequest alloc] initWithGraphPath:@"me/myEventApp: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];
一個動作沒有按」有一個og:url。一個對象確實需要引用一個對象。您應該將動作[@「og:url」]改爲動作[@「{my_object_type}」],將{my_object_type}替換爲可以進入動作的對象。 –
更新我的代碼,目前我沒有得到任何錯誤UIAlertView中,而這個錯誤: 錯誤域= NSURLErrorDomain代碼= -1002 「不支持URL」 的UserInfo = 0x170866400 {NSLocalizedDescription =不支持的URL,NSUnderlyingError = 0x1706457f0 「不受支持的URL」} 也試過課程[@「og:url」] = @「http://www.facebook.com」 – Angel
也注意到FBSDKLog:不支持的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」=「myEventApp:event」; 「og:url」=「http://www.facebook.com」; },跳過。 – Angel