iOS上的Facebook分享对话框:“发布”button始终呈灰色

我在Facebook开发者网站上创build了一个自定义的开放graphics对象,动作和故事,然后按照教程,通过正式的FB应用程序(无需login应用程序)发布它。 这是代码:

NSMutableDictionary<FBGraphObject> *object; NSString *returnUrl = [NSString stringWithFormat:@"http://tettomante.it/questions?%@", [NSString stringWithURLParams:@{@"answer": _answerLabel.text, @"divination": [self divinationNickname]}]]; object = [FBGraphObject openGraphObjectForPostWithType:@"boobs-teller:question" title:_questionTextView.text image:@"https://d1rdorpdffwq56.cloudfront.net/icona_tettomante.jpg" url:returnUrl description:_answerLabel.text]; NSMutableDictionary<FBOpenGraphAction> *action = (NSMutableDictionary<FBOpenGraphAction> *) [FBGraphObject openGraphActionForPost]; action[@"question"] = object; // Check if the Facebook app is installed and we can present the share dialog FBOpenGraphActionShareDialogParams *params = [[FBOpenGraphActionShareDialogParams alloc] init]; params.action = action; params.actionType = @"boobs-teller:ask"; params.previewPropertyName = @"question"; // If the Facebook app is installed and we can present the share dialog if([FBDialogs canPresentShareDialogWithOpenGraphActionParams:params]) { // Show the share dialog [FBDialogs presentShareDialogWithOpenGraphActionParams:params clientState:nil handler:^(FBAppCall *call, NSDictionary *results, NSError *error) { if(error) { // There was an error NSLog(@"Error publishing story: %@", error.description); } else { // Success NSLog(@"result %@", results); } }]; } 

问题是,一旦在FB应用程序中,自定义故事预览显示正确,并在大约10秒钟后消失,而顶部的“发布”button被禁用(灰色),并且不启用自身。 我不明白发生了什么事。 我以为这可能是因为该应用程序处于沙盒模式(我使用的是pipe理员用户,所以应该不重要),所以我公开,但没有任何改变。 然后我想我不得不让FB重新审视自定义的动作,所以我也把它整理出来了,但没有任何改变。 现在我不知道接下来要做什么。

我在创build新应用时遇到了同样的问题。 Open Graph标签必须是完全正确的,否则你将无法发布你的故事。

检查以确保在Facebook应用程序仪表板中创build的对象和操作与您在代码中列出的内容相匹配。

 object = [FBGraphObject openGraphObjectForPostWithType:@"boobs-teller:question" 

在这一行中,“boobs-teller”应该是您已经列为应用程序名称空间(Facebook Apps> Settings> Basic)的名称,“questions”应该是您在App仪表板中创build的自定义Object(Open Graph> Object Types) 。 如果你还没有创build这些,请点击这里: https : //developers.facebook.com/apps

 params.actionType = @"boobs-teller:ask"; 

在这一行中,“boobs-teller”应该是您的应用程序名称空间,“ask”是您在应用程序仪表板中创build的自定义Action(Open Graph> Action Types)。

更多细节在这里: https : //developers.facebook.com/docs/ios/open-graph/

您还可以在GitHub上查看示例iOS应用程序,FBOGSampleSD应用程序在学习Open Graph时帮助我了很多。 https://github.com/fbsamples/ios-howtos