GoViral - post to business page
My code is below. I use milkman goviral to post to a chosen business page. On android all is good. When i post the text the text appears on the feed of the page posted as the business user. But on IOS it appears as being posted by my private account to the business page - so posts as a visitor. The post therefore ends up in the visitor posts community area.
Anyone know why and what I can do about it?
sendButton.addEventListener(MouseEvent.CLICK, sendButtonClicked);
import com.milkmangames.nativeextensions.*;
import com.milkmangames.nativeextensions.events.*;
import flash.events.MouseEvent;
// Make sure the current platform is supported (as in, it's not a PC or Mac, etc.)
if (GoViral.isSupported()) {
GoViral.create();
} else {
trace("GoViral only works on mobile!");
return;
}
if (GoViral.goViral.isFacebookSupported()) {
// replace 000000 with your facebook app id!
GoViral.goViral.initFacebook("1981490431877564", "");
}
// Listen for events.
GoViral.goViral.addEventListener(GVFacebookEvent.FB_LOGGED_IN, onFacebookEvent);
GoViral.goViral.addEventListener(GVFacebookEvent.FB_LOGGED_OUT, onFacebookEvent);
GoViral.goViral.addEventListener(GVFacebookEvent.FB_LOGIN_CANCELED, onFacebookEvent);
GoViral.goViral.addEventListener(GVFacebookEvent.FB_LOGIN_FAILED, onFacebookEvent);
function onFacebookEvent(e: GVFacebookEvent) {
trace(e);
if (e.type == GVFacebookEvent.FB_LOGGED_IN) {
//GET PAGES
GoViral.goViral.facebookGraphRequest(
"me/accounts",
GVHttpMethod.GET, {},
"publish_actions,publish_pages,manage_pages").addRequestListener(function (e: GVFacebookEvent): void {
if (e.type == GVFacebookEvent.FB_REQUEST_RESPONSE) {
trace("Got: " + e.jsonData);
var json = JSON.parse(e.jsonData);
for (var i = 0; i < json.data.length; i++) {
comboboxMC.addItem({
label: json.data.name,
data: {
id: json.data.id,
access_token: json.data.access_token
}
});
}
} else {
trace("An error occurred posting : " + e.errorMessage);
}
});
}
}
// if the user is not already logged in...
if (!GoViral.goViral.isFacebookAuthenticated()) {
GoViral.goViral.authenticateWithFacebook("public_profile");
}
var pagePostParams: Object = {};
pagePostParams.message = "Test2";
pagePostParams.access_token = "";
function sendButtonClicked(e: MouseEvent) {
trace(comboboxMC.selectedItem.data.id)
trace(comboboxMC.selectedItem.data.access_token);
pagePostParams.access_token = comboboxMC.selectedItem.data.access_token;
GoViral.goViral.facebookGraphRequest(
(comboboxMC.selectedItem.data.id + "/feed"),
GVHttpMethod.POST,
pagePostParams,
"publish_actions,publish_pages,manage_pages").addRequestListener(function (e: GVFacebookEvent): void {
if (e.type == GVFacebookEvent.FB_REQUEST_RESPONSE) {
trace("Successfully posted to feed: " + e.jsonData);
mainText.text = "Successfully posted to feed: " + e.jsonData;
} else {
trace("An error occurred posting : " + e.errorMessage);
mainText.text = "An error occurred posting : " + e.errorMessage;
}
});
}
