Created
March 31, 2014 19:39
-
-
Save therealjohn/9900487 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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