gpt4 book ai didi

objective-c - Facebook SDK API IOS 发布到用户墙上时出错

转载 作者:塔克拉玛干 更新时间:2023-11-02 08:06:37 26 4
gpt4 key购买 nike

我在尝试发布到用户的 Facebook 墙上时遇到以下错误,而且我似乎找不到来源。有人对这个问题有一些见解吗?

2012-08-29 22:14:38.490 CanP[405:707] Error: HTTP status code: 400
2012-08-29 22:14:38.494 CanP[405:707] FBSDKLog: Response <#1111> <Error>:
The operation couldn’t be completed. (com.facebook.sdk error 5.)

将消息发布到 facebook 墙上的运行方法如下:

[FBSettings setLoggingBehavior:[NSSet setWithObjects:
FBLoggingBehaviorFBRequests,
nil]];
NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
[defaults setObject:[facebook accessToken] forKey:@"FBAccessTokenKey"];
[defaults setObject:[facebook expirationDate] forKey:@"FBExpirationDateKey"];
[defaults synchronize];

NSMutableDictionary *params = [NSMutableDictionary dictionaryWithObjectsAndKeys:
@"My test app", @"name",
@"http://www.google.com", @"link",
@"FBTestApp app for iPhone!", @"caption",
@"This is a description of my app", @"description",
@"Hello!\n\nThis is a test message\nfrom my test iPhone app!", @"message",
nil];

// Publish.
// This is the most important method that you call. It does the actual job, the message posting.
[facebook requestWithGraphPath:@"me/feed" andParams:params andHttpMethod:@"POST" andDelegate:self];

最佳答案

正如 C Abernathy 所建议的,您应该“在错误行放置一个断点并查看错误变量,然后向下钻取到一个名为 userInfo 的字典,它应该包含更易读的错误消息。”

对于我们这些测试新的 Facebook 集成的人来说,最常见的问题可能会显示在 error.userInfo "com.facebook.sdk .ParsedJSONResponseKey":

message = "(#506) Duplicate status message";

改变您用于测试 Facebook 集成的文本,您可能会发现您的代码工作正常!

关于objective-c - Facebook SDK API IOS 发布到用户墙上时出错,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12189396/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com