Skip to content

Instantly share code, notes, and snippets.

@pmark
Created November 17, 2011 05:20
Show Gist options
  • Save pmark/1372428 to your computer and use it in GitHub Desktop.
Save pmark/1372428 to your computer and use it in GitHub Desktop.
Post to Facebook wall
- (void)postMessageOnFacebook:(NSString*)message {
message = [NSString stringWithFormat:@"I just posted to %@ from %@.\n\n%@",
[AsyncEventHandler getCurrentCultName],
[AsyncEventHandler getCurrentMacro],
message];
[APP_DELEGATE.facebook requestWithGraphPath:@"me/feed"
andParams:[NSMutableDictionary dictionaryWithObjectsAndKeys:
message, @"message",
@"http://cult.me", @"link", nil]
andHttpMethod:@"POST"
andDelegate:self];
}
/**
* Called when an error prevents the request from completing successfully.
*/
- (void)request:(FBRequest *)request didFailWithError:(NSError *)error {
NSLog(@"FB post failed: %@", [error localizedDescription]);
}
/**
* Called when a request returns and its response has been parsed into
* an object.
*
* The resulting object may be a dictionary, an array, a string, or a number,
* depending on thee format of the API response.
*/
- (void)request:(FBRequest *)request didLoad:(id)result {
NSLog(@"FB post result: %@", result);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment