我的iPhone應用程序在牆上發佈Facebook發佈時遇到問題。我安裝了SDK和鏈接框架 登錄工作正常。這裏是代碼:在iPhone應用程序牆上的Facebook sdk發佈
-(IBAction)loginButtonPressed:(id)sender
{
NSLog(@"loginButtonPressed: called");
AppDelegate *appdel=[[UIApplication sharedApplication] delegate];
appdel.facebookSession=[[FBSession alloc] init];
[appdel.facebookSession openWithCompletionHandler:^(FBSession *session,
FBSessionState status,
NSError *error)
{
//
}];
}
但我有在用戶的牆上發佈消息的問題。這裏的代碼:
-(IBAction)likeButtonPressed:(id)sender
{
NSLog(@"likeButtonPressed: called");
// Post a status update to the user's feedm via the Graph API, and display an alert view
// with the results or an error.
NSString *message = @"test message";
NSDictionary *params = [NSDictionary dictionaryWithObject:message forKey:@"message"];
// use the "startWith" helper static on FBRequest to both create and start a request, with
// a specified completion handler.
[FBRequest startWithGraphPath:@"me/feed"
parameters:params
HTTPMethod:@"POST"
completionHandler:^(FBRequestConnection *connection, id result, NSError *error) {
[self showAlert:message result:result error:error];
}];
}
請幫助我。我的代碼有什麼問題?或者我應該添加一些權限登錄請求?
你忘了描述實際_problem /錯誤_。 – CBroe 2012-07-18 11:36:04
當你啓動你的Facebook發佈時,是否顯示登錄表單? – 2012-07-18 11:36:05
我在調試中收到一條消息:'錯誤:HTTP狀態碼:400'和'操作無法完成。 (com.facebook.FBIOSSDK錯誤5.)'in'IAlertView' – user1385666 2012-07-18 11:36:14