iPhone Facebook sdk,发布到墙上

时间:2011-06-28 08:07:42

标签: objective-c ipad facebook

我从iPhone SDK示例代码中获得了以下示例,并且可能尝试了其他10个但我似乎无法将消息发布到我的墙上。我不希望出现一个对话框弹出窗口供我输入我的消息,我想要它,所以当用户点击一个帖子按钮,消息将自动发布到我的墙上。我在iPad上使用新版本的Facebook iPhone SDK。

我很欣赏如果有人能够发现我出错的地方,目前我没有任何错误或警告。我拥有的权限是“email”和“publish_stream”。

提前谢谢。

如果有兴趣的话,我在Facebook上找到了App页面(http://www.facebook.com/settings/?tab=applications)。

SBJSON *jsonWriter = [[SBJSON new] autorelease];

NSDictionary* actionLinks = [NSArray arrayWithObjects:[NSDictionary dictionaryWithObjectsAndKeys:
                                                       @"Always Running",@"text",@"http://itsti.me/",@"href", nil], nil];

NSString *actionLinksStr = [jsonWriter stringWithObject:actionLinks];
NSDictionary* attachment = [NSDictionary dictionaryWithObjectsAndKeys:
                            @"a long run", @"name",
                            @"The Facebook Running app", @"caption",
                            @"it is fun", @"description",
                            @"http://itsti.me/", @"href", nil];
NSString *attachmentStr = [jsonWriter stringWithObject:attachment];
NSMutableDictionary* params = [NSMutableDictionary dictionaryWithObjectsAndKeys:
                               @"Share on Facebook",  @"user_message_prompt",
                               actionLinksStr, @"action_links",
                               attachmentStr, @"attachment",
                               nil];
NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
NSLog(@"%@",[NSString stringWithFormat:@"%@/feed", [defaults objectForKey:USERID]]);
[facebook requestWithMethodName:[NSString stringWithFormat:@"%@/feed", [defaults objectForKey:USERID]]
                       andParams:params
                   andHttpMethod:@"POST"
                     andDelegate:self]; 

如果其他人偶然发现并希望知道如何删除该选项,以便safari不接管您的屏幕,请找到以下内容并设置safariAuth:NO。

[self authorizeWithFBAppAuth:YES safariAuth:YES];

您还需要从以下方法中取消注释“return”,以便每次用户在输入框和解除键盘之间点击时,网页都不会从其持有者中展开。

  • (无效)keyboardWillShow:(NSNotification *)通知

0 个答案:

没有答案