0

Well after a lot of researching and hitting my head in the wall a few times i came up almost ending my code. I am being able to connect to facebook and even send message requests but im not being able to send picture ones. Here is the code:

            s3eFBRequest* pWallPostRequest = s3eFBRequest_WithGraphPath(MultiLoginScene::getSession(), "me/photos", "POST");
            s3eFBRequest_AddParamString(pWallPostRequest, "picture", MakeScreenshot());
            //s3eFBRequest* pWallPostRequest = s3eFBRequest_WithGraphPath(MultiLoginScene::getSession(), "me/feed", "POST");
            //s3eFBRequest_AddParamString(pWallPostRequest, "message", "Here's a wall post!");
            s3eFBRequest_AddParamString(pWallPostRequest, "access_token", s3eFBSession_AccessToken(MultiLoginScene::getSession()));
            s3eFBRequest_Send(pWallPostRequest, GraphRequestCallback, NULL);

And about the MakeScreenshot()

static void flipVertical(unsigned char *data, int w, int h)
{
  int x, y, i1, i2;
  unsigned char temp;
  for (x=0;x<w;x++){
    for (y=0;y<h/2;y++){
      i1 = (y*w + x)*3; // this pixel
      i2 = ((h - y - 1)*w + x)*3; // its opposite (across x-axis)

      // swap pixels
      temp = data[i1];
      data[i1] = data[i2];
      data[i2] = temp;

      i1++; i2++;
      temp = data[i1];
      data[i1] = data[i2];
      data[i2] = temp;

      i1++; i2++;
      temp = data[i1];
      data[i1] = data[i2];
      data[i2] = temp;

    }
  }
}

const char* MainMenuScene::MakeScreenshot()
{
  static int count = 0;
  static char file[] = "PicaSim-00000.png";
  sprintf(file, "PicaSim-%05d.png", count++);

 // int w = s3eSurfaceGetInt(S3E_SURFACE_WIDTH);
  //int h = s3eSurfaceGetInt(S3E_SURFACE_HEIGHT);

  int w = 600;
  int h = 600;

  int dataSize = w * h * 3;
  unsigned char *framebuffer = 
    (unsigned char *) malloc(dataSize * sizeof(unsigned char));
  glReadPixels(0, 0, w, h, GL_RGB, GL_UNSIGNED_BYTE, framebuffer);
  flipVertical(framebuffer, w, h);

  /* CIwImage image;
  image.SetFormat(CIwImage::BGR_888);
  image.SetWidth(w);
  image.SetHeight(h);
  image.SetBuffers(framebuffer, dataSize);
  image.SavePng(file);

  free(framebuffer);*/
  return (const char *)framebuffer;
}

After all im getting a failed response from my callback... What can i be doing wrong? I just need to send a screenshoot to facebook... Any idea why isnt working?

EDIT:

So i tried sending a URL as a parameter but still not working here's the code

s3eFBRequest* pWallPostRequest = s3eFBRequest_WithGraphPath(MultiLoginScene::getSession(), "me/photos", "POST");
            s3eFBRequest_AddParamString(pWallPostRequest, "picture", "http://img1.wikia.nocookie.net/__cb20130407100142/onepiece/pt/images/d/d8/Goku_2.jpg");
            s3eFBRequest_AddParamString(pWallPostRequest, "access_token", s3eFBSession_AccessToken(MultiLoginScene::getSession()));
            s3eFBRequest_Send(pWallPostRequest, GraphRequestCallback, NULL);

But is still not working ... any clue?

user3481379
  • 11
  • 1
  • 6

1 Answers1

0

You're sending a frame buffer as a parameter to Facebook!!

Facebook accepts only picture URL as a picture parameter. So your picture needs to be uploaded on a web-server and the url needs to be in the picture parameter where you're sending the frame buffer.

0xC0DED00D
  • 19,522
  • 20
  • 117
  • 184
  • I eddited my question give it a look – user3481379 May 02 '14 at 16:52
  • I tried getting the error using s3eFacebookGetErrorString() but it only works in debug and the facebook stuff only in the device that is release so i dont even know why it isnt working – user3481379 May 02 '14 at 18:10
  • Have you seen this example of image sharing using s3efacebook? - http://api.madewithmarmalade.com/ExampleS3EFacebook.html – 0xC0DED00D May 03 '14 at 14:11
  • I have the example working on marmalade and with my ipad with io7 i the buttons are always "dark" like no avaiable so edited it to be avaiable but it obviously doesnt work. I putted in android and it doesnt work too, maybe cuz the button name is "Share Image with Native UI (ios 6+)" in android and ios the name is the same... So it doesnt work im still stuck on this... no one make any ideia how to do that? – user3481379 May 05 '14 at 13:35
  • Well guys, i'm sorry my lame behavior before this chat like asking a lot of the same question. I still didn't find an answer for my problem i really tried everything if someone could help me find anyway of doing that using a url or adding a buffer to this request so i can make it right i would be really thankful – user3481379 May 06 '14 at 12:21
  • Please read the steps first to setup facebook for your selected platform from facebook developer console. Then debug what error are you getting. The example works perfectly fine for me. – 0xC0DED00D May 06 '14 at 12:47
  • The s3eFBSLComposeViewController_Create() only works for iOS as said in documentation i need a way for it to work on both of then so i tried asking for help on building the facebook request but when i put "picture" or "source" i need to pass the image as a value but i dont know exactly what to pass or how so i dont know what to do since i cant run debug only release – user3481379 May 06 '14 at 14:14
  • ok, first you need to understand that s3eFacebook is just an extension/plugin made using marmalade edk. It surely won't be having all those functions required for all platforms. If you're not happy with the functions provided for the platform you want, you can always create your own custom extension. You can ask some professional to do it for you, giving your preferences. There're plenty of them to be found on marmalade forum. I happen to be one of them. – 0xC0DED00D May 07 '14 at 06:18