Objective c 在Facebook上把问题贴到墙上
当我通过我的应用程序登录Facebook时,一切正常,但我在发布到墙上时遇到了问题Objective c 在Facebook上把问题贴到墙上,objective-c,ios,facebook,facebook-graph-api,Objective C,Ios,Facebook,Facebook Graph Api,当我通过我的应用程序登录Facebook时,一切正常,但我在发布到墙上时遇到了问题 - (NSString *) postToFBWallStatus:(NSString *) status andSetDelegate: (id) delegate { if (! isFBLoggedIn) { return @"NotLoggedin"; } NSString *message = status; NSLog(@"Appdelega
- (NSString *) postToFBWallStatus:(NSString *) status andSetDelegate: (id) delegate
{
if (! isFBLoggedIn)
{
return @"NotLoggedin";
}
NSString *message = status;
NSLog(@"Appdelegate: postToFBWallStatus:andSetDelegate:");
NSLog(@"to be delegate class: %@",[delegate class]);
NSURL *url = [NSURL URLWithString:@"https://graph.facebook.com/me/feed"];
ASIFormDataRequest *newRequest = [ASIFormDataRequest requestWithURL:url];
[newRequest setPostValue:message forKey:@"message"];
[newRequest setPostValue:@"" forKey:@"name"];
[newRequest setPostValue:@"" forKey:@"caption"];
[newRequest setPostValue:@"" forKey:@"description"];
[newRequest setPostValue:@"" forKey:@"link"];
[newRequest setPostValue:@"" forKey:@"picture"];
[newRequest setPostValue:_accessToken forKey:@"access_token"];
[newRequest setDidFinishSelector:@selector(postToWallFinished:)];
[newRequest setDidFailSelector:@selector(postToWallFailed:)];
[newRequest setDelegate:delegate];
[newRequest startAsynchronous];
return @"Loggedin";
}
当我在Facebook墙上发帖时,我收到了以下信息:
error = {
message = "Invalid access token signature.";
type = OAuthException;
};
您必须使用用户的
access\u令牌
将信息张贴到他们的墙上。此外,用户需要允许API调用工作的publish\u流
权限。对用户进行身份验证时,请将publish\u stream
添加到权限范围中。我也遇到了同样的问题。问题是我的数据库正在截断访问令牌,因为我将存储它的列设置为VARCHAR(100)。事实证明,100个字符对于某些访问令牌是不够的,因此,正在发送的访问令牌无效。您如何获取访问令牌的值?您需要向Facebook注册以获取Oauth密钥,然后用户需要批准应用程序才能工作。您不使用Facebook SDK for iOS有什么原因吗?