Skip to content

Instantly share code, notes, and snippets.

@therealjohn
Created March 31, 2014 19:39
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save therealjohn/9900487 to your computer and use it in GitHub Desktop.
Save therealjohn/9900487 to your computer and use it in GitHub Desktop.
var accountStore = new MonoTouch.Accounts.ACAccountStore();
var accType = accountStore.FindAccountType(ACAccountType.Facebook);
var accounts = accountStore.FindAccounts(accType);
var post = new NSString("Hello Facebook!");
if(accounts.Count() > 0)
{
var accountType = accountStore.FindAccountType(ACAccountType.Facebook);
accountStore.RequestAccess(accountType, null, (granted, error) => {
if(granted)
{
var request = SLRequest.Create(SLServiceKind.Facebook,
SLRequestMethod.Post,
NSUrl.FromString("https://graph.facebook.com/me/feed"),
NSDictionary.FromObjectAndKey(post, new NSString("message"))
);
var account = accountStore.FindAccounts(accountType).First();
request.Account = account;
request.PerformRequest((data, response, e) => {
// Do something
});
}
else
{
}
});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment