0

When I login to Facebook through my app, everything works, but I'm having problems posting to walls.

- (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";
}

I get this message when I post to the Facebook wall:

error =     {
        message = "Invalid access token signature.";
        type = OAuthException;
    };
4
  • 1
    I've had the same problem. The problem was that my database was truncating the access token because I had the column that stores it set as a VARCHAR(100). As it turns out, 100 characters isn't enough for some access tokens, so the access token that was being sent was invalid. Jul 31, 2011 at 1:20
  • How are you obtaining the value for the access token?
    – jBit
    Jul 31, 2011 at 12:37
  • You're going to need to register with Facebook to get an Oauth key and then the user needs to approve the application before it will work. Jul 31, 2011 at 12:57
  • Is there a reason you aren't using the Facebook SDK for iOS?
    – dtuckernet
    Aug 7, 2011 at 4:00

1 Answer 1

0

You must use the user's access_token to post information to their wall. Furthermore, the user needs to allow the publish_stream permission for the API call to work. When you authenticate the user, add publish_stream to the scope of permissions.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.