【问题标题】:Facebook API dialog page showing error in second time and after thatFacebook API 对话框页面在第二次和之后显示错误
【发布时间】:2012-02-11 07:51:06
【问题描述】:

我想分享我的应用程序详细信息。我刚刚完成了与 facebook 教程中相同的操作。当用户登录并出现对话框页面时,我发布了我的 msg。它仅在第一次运行良好。当用户点击按钮时再次分享,对话框出现并显示错误页面

"Error occurred with 'Your_APP_NAME'.please try again later."

我按照下面 facebook 链接中的教程进行操作。 https://developers.facebook.com/docs/mobile/ios/build/

这是我的代码。

-(void)buttonPressed:(id)sender{
facebook = [[Facebook alloc] initWithAppId:@"YOUR_APP_ID" andDelegate:self];

 NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
        if ([defaults objectForKey:@"FBAccessTokenKey"] && [defaults objectForKey:@"FBExpirationDateKey"]) {
            facebook.accessToken = [defaults objectForKey:@"FBAccessTokenKey"];
            facebook.expirationDate = [defaults objectForKey:@"FBExpirationDateKey"];
        }
if (![facebook isSessionValid]) {
    [facebook authorize:nil];
}else{
[self postWall];
}
// Pre 4.2 support
- (BOOL)application:(UIApplication *)application handleOpenURL:(NSURL *)url {
    return [facebook handleOpenURL:url]; 
}
- (void)fbDidLogin {
    NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
    [defaults setObject:[facebook accessToken] forKey:@"FBAccessTokenKey"];
    [defaults setObject:[facebook expirationDate] forKey:@"FBExpirationDateKey"];
    [defaults synchronize];
    [self postWall];
}
-(void)postWall{

    NSMutableDictionary* params = [NSMutableDictionary dictionaryWithObjectsAndKeys:
                                   kAppId,@"app_id",
                                   @"https://developers.facebook.com/docs/reference/dialogs/",@"link",
                                   @"http://fbrell.com/f8.jpg",@"picture",
                                   @"Facebook Dialogs",@"name",
                                   @"Reference Documentation",@"caption",
                                   @"Using Dialogs to interact with users.",@"description",
                                   @"Facebook Dialogs are so easy!",@"message",
                                   nil];

    [[self facebook] dialog:@"feed" andParams:params andDelegate:self];

}

我在我的视图控制器文件中执行所有这些代码(不在应用程序委托中)。我只想在按下按钮时打开 facebook。所以我将这些编码放在我的 buttonpressed 方法中。

【问题讨论】:

  • 请贴一些代码,没有足够的细节
  • @Hanon 我检查了 facebook API 的流程..我认为我在 shouldStartLoadWithRequest: in FBDialog 文件中遇到错误..在该代码中检查 URL 方案“如果循环”没有作为“fbconnect”传递,而是像“https”一样传递。

标签: iphone objective-c ios facebook facebook-graph-api


【解决方案1】:

尝试删除

kAppId,@"app_id"

来自您的NSMutableDictionary params

【讨论】:

  • 非常感谢!...非常感谢....它的工作..最后我让它工作..但我有一个疑问?如果这只是一个问题,那么你facebook 本身在 params 中给出了 appId 这样的教程???
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2023-04-04
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多