Skip to main content
Inspiring
March 23, 2018
Question

GoViral - post to business page

  • March 23, 2018
  • 1 reply
  • 529 views

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;

  }

  });

  }

This topic has been closed for replies.

1 reply

natural_criticB837
Legend
March 24, 2018

My best guess is that this happens because the Facebook SDK on GoViral is outdated. For iOS we even see a warning in the Facebook dashboard. I wrote an email to ask if there are plans to update GoViral with the latest SDK but so far no response.

natural_criticB837
Legend
March 24, 2018

It might also be worth to check the graph API changelog, there was a recent change regarding managing businesses. There is a new permission now. Not sure if that is related to your problem though.