Gabe
Gabe

Reputation: 50523

Set Facebook status using iphone app

I have just started with the new graph api for facebook. I have gotten a few items to work like logging in and getting the user name and displaying this to the screen. I am having trouble figuring out how to set my status with the graph api... I have tried a couple things but I always receive and error response back.

Any ideas?

NSMutableDictionary *params = [NSMutableDictionary  dictionaryWithObjectsAndKeys:
                               @"test2", @"test",
                               nil];

[_facebook requestWithMethodName:@"status.set"
                       andParams:params
                   andHttpMethod:@"POST"
                     andDelegate:self];

Upvotes: 1

Views: 1704

Answers (2)

Blitz
Blitz

Reputation: 5671

That doesn't look like the new api to me. I haven't actually done this kinda stuff on iOS, but looking at the API something like this would be more in line:

NSMutableDictionary *params = [NSMutableDictionary  dictionaryWithObjectsAndKeys:
                        @"test message from stackoverflow", @"message",                             
                           nil];
[_facebook requestWithGraphPath:@"/me/feed"
               andParams:params
             andDelegate:self]

Your code uses the old REST API. My method above uses the newer Graph API. You should really dig the Graph API. MethodName can never be in the Graph API

[edit] just for references, I edited my code to be correct, obviously, you found the correct answer yourself :D

Upvotes: 0

Gabe
Gabe

Reputation: 50523

LordT was close but here's the final solution:

NSMutableDictionary *params = [NSMutableDictionary  dictionaryWithObjectsAndKeys:
                      @"My new status message", @"message",
                      nil];
[_facebook requestWithGraphPath:@"/me/feed"
                  andParams:params
                  andHttpMethod:@"POST"
            andDelegate:self];

Upvotes: 2

Related Questions