请参阅页面底部的 12 月 29 日更新说明。
嗨,我正在对其他人的 iOS 项目进行维护工作(这是一种灵魂毁灭,因为他们没有记录他们的代码)。
问题是用户登录后,尝试将帖子分享到墙上总是会导致
错误 100:“帖子的链接必须指向应用程序的连接或画布 URL ”。
我已经搜索了过去 2 个小时,但没有找到任何专门针对 iOS 的结果(但对于 wordpress 来说很多,这没有帮助)
任何可能导致这种情况的想法。
下面是贴到墙上的海外开发者代码:
-(void)uploadPropertyDetailsOnFacebookWall
{
[FBSettings setLoggingBehavior:[NSSet setWithObjects:FBLoggingBehaviorFBRequests, FBLoggingBehaviorFBURLConnections, nil]];
NSString* photoURL = @"";
NSString *strFullPropertyDetailLink=@"";
if (!kIsListOnce) {
photoURL = [currentItem objectForKey:@"Photo1FeaturedURL"];
strFullPropertyDetailLink=[currentItem objectForKey:@"FullDisplayLink"];
}
else {
strFullPropertyDetailLink=[currentItem objectForKey:@"FullDisplayLink"];
NSArray* list = [[currentItem objectForKey:@"objects"] objectForKey:@"img_small"];
;
if ([list count] > 0) {
photoURL = [list objectAtIndex:0];
}
}
[UIApplication sharedApplication].networkActivityIndicatorVisible = YES;
NSString *strLinkOfApp=(NSString *)[Utils config:KiTunesstoreAppLink]; //strFullPropertyDetailLink,
NSDictionary *postParams =
[[NSMutableDictionary alloc] initWithObjectsAndKeys:
strFullPropertyDetailLink, @"link",
photoURL, @"picture",
[Utils config:kTextAgentName], @"name",
strAddress, @"caption",
[currentItem objectForKey:@"Description"], @"description",
nil];
[FBRequestConnection startWithGraphPath:@"me/feed"
parameters:postParams
HTTPMethod:@"POST"
completionHandler:^(FBRequestConnection *connection,
id result,
NSError *error)
{
[UIApplication sharedApplication].networkActivityIndicatorVisible = NO;
NSString *alertText;
NSLog(@"%@",error);
if (error) {
NSDictionary *dict=[error userInfo];
NSLog(@"%@",dict);
NSDictionary *dictJSON=[dict objectForKey:@"com.facebook.sdk:ParsedJSONResponseKey"];
NSDictionary *dictBody=[dictJSON objectForKey:@"body"];
NSDictionary *dictError=[dictBody objectForKey:@"error"];
NSString *strCode=[[dictError objectForKey:@"code"] description];
if([strCode isEqualToString:@"200"])
{
alertText = @"You have not authorized the application to perform this publish action";
}else{
alertText = [@"An error ocurred: " stringByAppendingString:error.description];
alertText=[alertText stringByAppendingString: strFullPropertyDetailLink];
}
} else {
alertText = [NSString stringWithFormat:
@"Property details has been successfully shared on your Facebook Wall"];
}
[[[UIAlertView alloc] initWithTitle:@"Result"
message:alertText
delegate:nil
cancelButtonTitle:@"OK!"
otherButtonTitles:nil] show];
// Show the result in an alert
}];
}
这是我不断收到的错误:
Error Domain=com.facebook.sdk Code=5 "The operation couldn’t be completed(com.facebook.sdk error 5.)" UserInfo=0x1d548710 {com.facebook.sdk:ParsedJSONResponseKey={
body = {
error = {
code = 100;
message = "(#100) The post's links must direct to the application's connect or canvas URL.";
type = OAuthException;
};
};
code = 400;
}, com.facebook.sdk:HTTPStatusCode=400}
2013-08-02 12:06:12.806 RealEstate[385:907] {
"com.facebook.sdk:HTTPStatusCode" = 400;
"com.facebook.sdk:ParsedJSONResponseKey" = {
body = {
error = {
code = 100;
message = "(#100) The post's links must direct to the application's connect or canvas URL.";
type = OAuthException;
};
};
code = 400;
};
}
请帮忙,自从我最初发布以来,我在网上做了更多的研究,但仍然找不到答案。
12月17日更新:
我正在使用 SDK 3.1.1。我想避免更新,因为我正在维护别人的代码。
在 fbrequestconnection 中使用 me/feed 时,除“消息”之外的任何其他参数都会使应用程序崩溃。
我还尝试使用其他堆栈溢出用户建议的设置将应用程序链接到测试帐户,可在此处查看
我还禁用了流媒体后的安全性
其他问题
- 在将应用程序链接到 Facebook 时,我是否遗漏了什么?
- 为什么它不会检测到“链接”参数与画布 url 相同?