Iphone 使用新sdk在我的facebook墙上发布

Iphone 使用新sdk在我的facebook墙上发布,iphone,ios,facebook,Iphone,Ios,Facebook,我正在使用新的Facebook SDK在我的墙上发布以下内容 我从应用程序获得了授权,但当我尝试发布时,我得到了一个错误 错误:HTTP状态代码:400下面我正在发布我的代码 - (void)viewDidLoad { self.postParams = [[NSMutableDictionary alloc] initWithObjectsAndKeys: @"https://developers.facebook.com/ios", @"link", @"https://develo

我正在使用新的Facebook SDK在我的墙上发布以下内容

我从应用程序获得了授权,但当我尝试发布时,我得到了一个错误
错误:HTTP状态代码:400
下面我正在发布我的代码

 - (void)viewDidLoad
{
self.postParams =
 [[NSMutableDictionary alloc] initWithObjectsAndKeys:
 @"https://developers.facebook.com/ios", @"link",
 @"https://developers.facebook.com/attachment/iossdk_logo.png", @"picture",
 @"Facebook SDK for iOS", @"name",
 @"build apps.", @"caption",
 @"testing for my app.", @"description",
 nil]; 

[self.postParams setObject:@"hgshsghhgsls" forKey:@"message"];

[super viewDidLoad];
// Do any additional setup after loading the view, typically from a nib.
}

-(IBAction)Post{
AppDelegate *appDelegate = [UIApplication sharedApplication].delegate;
[appDelegate openSessionWithAllowLoginUI:YES];


[FBRequestConnection   startWithGraphPath:@"me/Mac" parameters:self.postParams HTTPMethod:@"POST"
                        completionHandler:^(FBRequestConnection *connection,id result,NSError *error) {
                            NSString *alertText;
                             if (error) {
                             alertText = [NSString stringWithFormat:@"error: domain = %@, code = %d, des = %d",error.domain, error.code,error.description];
                             } 
                             else 
                             {
                             alertText = [NSString stringWithFormat:@"Posted action, id: %@",[result objectForKey:@"id"]];
                             }
                             // Show the result in an alert
                             [[[UIAlertView alloc] initWithTitle:@"Result" message:alertText delegate:self cancelButtonTitle:@"OK!"
                             otherButtonTitles:nil]show];
                        }]; 




}

我在这里做错了什么?任何建议都会很好,而这个新SDK是测试版?还是完整的?

最后,我解决了这个问题,因为我必须在我的应用程序权限页面中将Auth Token参数更改为URLFragment,然后它才能正常工作

如果您遇到任何问题,请尝试通过在您感兴趣的请求调用之前添加以下代码来打开日志记录:

[FBSettings setLoggingBehavior:[NSSet]
setWithObjects:FBLoggingBehavior FBRequests,
FBLoggingBehaviorFBURLConnections,

无]]

我在项目中使用了这个框架。它工作正常。这是我的相关代码

   -(IBAction)logIn:(id)sender;
{
AppDelegate *appdelegate = (AppDelegate *)[[UIApplication sharedApplication] delegate];
if (!FBSession.activeSession.isOpen) {
    [appdelegate sessionOpener];
}
else {
    [self loginHelp];
}
我的sessionOpener函数是

 -(void) sessionOpener
{

}


它对我有用。可能对您有帮助。

检查会话发布权限

这对我很管用

[FBSession openActiveSessionWithPublishPermissions:[[NSArray alloc] initWithObjects:@"publish_stream",@"email", nil]
                                   defaultAudience:FBSessionDefaultAudienceFriends
                                      allowLoginUI:YES
                                 completionHandler:^(FBSession *session,
                                                     FBSessionState state, NSError *error) {
                                     [self sessionStateChanged:session state:state error:error];
                                 }];

你能把整行错误都贴出来吗?执行NSLog(@“%@”,错误);然后你会看到整个描述,为什么会抛出400错误。或者发布警报输出的消息…2012-08-30 14:33:05.225 NewFbLogin[1275:fe03]错误:HTTP状态代码:400抱歉这个愚蠢的问题,但是您有有效的登录和facebook会话?可能按照这个图坦卡蒙:这是nslog,错误太大了,我无法完全发布。错误域=com.facebook.sdk代码=5“操作无法完成。(com.facebook.sdk错误5。)”用户信息=0x6b8ab10{com.facebook.sdk:ParsedJSONResponseKey={type=mutable dict,count=2,另一个问题:什么是我/苹果?它必须是我/feed,如果你想发布…嗨,回答我,你能再解释一下解决方案是什么吗?当你说你的应用程序许可页面时,你是指developer.facebook.com吗?也许你一步一步地做了什么?谢谢。是的,在developer.facebook.com我选择了我的应用程序编辑设置,在下一页中,我选择了左侧的权限,在Auth Token Parameter选项中,我更改为URL片段选项。这就是我所做的一切,它正在为答案工作。我遇到了相同的错误,并用正确的答案解决了它,但这可能会帮助某些人。我不知道为什么有人失败了-投票给你。我改变了这个参数,但仍然没有运气:(和我一样。你们有人解决了吗?如果你们能帮助的话会很好。谢谢。很棒的提示。谢谢分享。
[FBSession openActiveSessionWithPublishPermissions:[[NSArray alloc] initWithObjects:@"publish_stream",@"email", nil]
                                   defaultAudience:FBSessionDefaultAudienceFriends
                                      allowLoginUI:YES
                                 completionHandler:^(FBSession *session,
                                                     FBSessionState state, NSError *error) {
                                     [self sessionStateChanged:session state:state error:error];
                                 }];