Facebook API 对话框页面在第二次及之后显示错误 [英] Facebook API dialog page showing error in second time and after that
问题描述
我想分享我的应用程序详细信息.我只是按照 facebook 教程中的说明做了.当用户登录和对话框页面出现时,我发布了我的 msg.它只在第一次正常工作.当用户点击按钮时再次分享,出现对话框并显示错误页面
I want to share my app details.I just done as same given in facebook tutorial.When user loggen in and dialog page appears and i posted my msg.and it worked fine for first time only.when user tapped a button to share again,the dialog appears and showing error page
'Your_APP_NAME'出现错误.请稍后再试."
我按照这里下面的 facebook 链接中的教程进行操作.https://developers.facebook.com/docs/mobile/ios/build/一个>
I followed the tutorial in the facebook link below here. 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..所以我将这些代码放在我的按钮按下方法中.
I do all this code in my viewcontroller file(Not in app delegate).I want to open facebook only when i press the button..So i put these codings in my buttonpressed method.
推荐答案
尝试删除
kAppId,@"app_id"
来自您的 NSMutableDictionary 参数
这篇关于Facebook API 对话框页面在第二次及之后显示错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!