我嘗試在使用新(beta)facebook ios sdk 3.0的應用中添加facebook集成。所有我想要發佈狀態更新到Facebook。我用FBLoginView登錄Facebook。我按照facebook上的指示將我的應用程序ID放在plist中。我把一些代碼發佈到Facebook。ios-Facebook SDK 3.0錯誤5當發佈狀態更新
(void)viewDidLoad
{
[super viewDidLoad];
NSArray *perms;
perms = [NSArray arrayWithObjects:@"status_update", nil];
FBLoginView *loginview =
[[FBLoginView alloc] initWithPermissions:perms];
loginview.frame = CGRectOffset(loginview.frame, 5, 5);
loginview.delegate = self;
[self.view addSubview:loginview];
// Do any additional setup after loading the view, typically from a nib.
}
- (IBAction)poststatus:(UIButton *)sender {
NSString *message = [NSString stringWithFormat:@"Test staus update"];
[FBRequestConnection startForPostStatusUpdate:message
completionHandler:^(FBRequestConnection *connection, id result, NSError *error) {
[self showAlert:message result:result error:error];
}];
}
- (void)showAlert:(NSString *)message
result:(id)result
error:(NSError *)error {
NSString *alertMsg;
NSString *alertTitle;
if (error) {
alertMsg = error.localizedDescription;
alertTitle = @"Error";
} else {
NSDictionary *resultDict = (NSDictionary *)result;
alertMsg = [NSString stringWithFormat:@"Successfully posted '%@'.\nPost ID: %@",
message, [resultDict valueForKey:@"id"]];
alertTitle = @"Success";
}
UIAlertView *alertView = [[UIAlertView alloc] initWithTitle:alertTitle
message:alertMsg
delegate:nil
cancelButtonTitle:@"OK"
otherButtonTitles:nil];
[alertView show];
}
奇怪的是,這段代碼工作一次。第一次驗證用戶身份後,我可以成功發佈ONE狀態更新。之後,所有後續嘗試將失敗並出現FBiOSSDK錯誤5(在控制檯中,錯誤:HTTP狀態碼:400)。解決此問題的唯一方法是從Facebook帳戶中刪除應用程序並重新進行身份驗證。我不確定問題是什麼。我在網上尋找解決方案,但找不到任何東西。如果有人知道如何解決這個問題,請告訴我。謝謝
得到了相同的代碼。帶着改變的app_id玩弄美味的Facebook示例項目。也許它是相關的... – Centurion 2012-08-14 06:45:57
我相信這個問題是由於某種原因,你不能在一段時間內發佈一次相同的狀態更新。如果您嘗試發佈相同的狀態更新,請嘗試在每個帖子後更改它 – benjih555 2012-08-14 17:15:15
發現問題。在返回的NSError的userInfo中有響應消息「Feed action request limit reached」。進一步挖掘... – Centurion 2012-08-22 09:25:07