how to post to wall after logging in to FB
質問
i will like to know how to post to my own wall with a string @"123456789" after logging in to FB with this
facebook = [[Facebook alloc] initWithAppId:kAppId andDelegate:self];
// Check and retrieve authorization information
NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
if ([defaults objectForKey:@"FBAccessTokenKey"] && [defaults objectForKey:@"FBExpirationDateKey"]) {
facebook.accessToken = [defaults objectForKey:@"FBAccessTokenKey"];
facebook.expirationDate = [defaults objectForKey:@"FBExpirationDateKey"];
}
// Initialize user permissions
userPermissions = [[NSMutableDictionary alloc] initWithCapacity:1];
if (![facebook isSessionValid]) {
NSArray *permissions = [[NSArray alloc] initWithObjects:
@"publish_stream",
nil];
[facebook authorize:permissions];
//[permissions release];
}
解決
use the following code to feed
NSMutableDictionary *params = [NSMutableDictionary dictionaryWithObjectsAndKeys:
[NSString stringWithFormat:@"YOUR MESSAGE"],
@"message", nil];
[facebook requestWithGraphPath:@"me/feed" andParams:params andHttpMethod: @"POST" andDelegate:self];
他のヒント
You can always create your own request and post it to facebook, like the following request: you specify what you want from: type, link, picture, source, message, name, caption, description, and you must provide an access_token, which if you're using facebook api, you can get easily.
所属していません StackOverflow