- Home /
Question by
AodaiIrshed · Nov 26, 2014 at 12:55 PM ·
facebook
Posting to Facebook wall using HttpMethod.POST unity3D
well I am using unity and trying to post on my wall... I imported the Facebook sdk and i used the code in their docs which is
int score = 10000;
var scoreData = new Dictionary () {{"score", score.ToString()}};
FB.API ("/me/scores", HttpMethod.POST, LogCallback, scoreData); and i have allowed the publish settings (when i logged in ) still nothing happens .. so here is my code exactly
void Awake(){
FB.Init (SetInit, OnHideUnity);
}
private void SetInit(){
Debug.Log("IN");
}
private void OnHideUnity(bool isGameShown){
if (!isGameShown) {
Time.timeScale=0;
}
else {
Time.timeScale = 1;
}
}
void FBlogin()
{if (!FB.IsLoggedIn) {
FB.Login ("email,publish_actions", AuthCallback);
}
else { if (FB.IsLoggedIn) {
// Screen.orientation = ScreenOrientation.LandscapeRight;
Dictionary<string,string> score1=new Dictionary<string, string>();
score1.Add("Score","100");
FB.API ("/me/scores",Facebook.HttpMethod.POST, AuthCallback, score1);
Debug.Log("Okay");
}
}
}
void AuthCallback(FBResult result){
if (FB.IsLoggedIn) {
// Screen.orientation = ScreenOrientation.LandscapeRight;
int score = 10000;
Dictionary<string,string> scoreData =
new Dictionary<string, string>() {{"score", score.ToString()}};
FB.API ("me/scores", HttpMethod.POST, LogCallback, scoreData);
Dictionary<string,string> scoreData1 =
new Dictionary<string, string>() {{"score", "0"}};
}
else {
Debug.Log("FB LOGIN ERROR");
}
}
Comment