Facebook "Like", Prime31 (ACTUAL $400 PayPal REWARD)

It looks like @andsee has won this paid challenge, and been forwarded the reward. Thank you for the thousands of people, well 4, who contributed towards this fascinating experiment!! Thank you!


Now increased to $400 !!!

We’ll pay a $400 reward instantly (paypal) to the fastest and most good answer here!!

To yourself or your favourite charity.

(Don’t hesitate to “pm” me … just click to the “forum” site to find the “pm” button - they didn’t add a “pm” button on this answers site.)


We’ve recently had a hell of a time hiring someone, who is expert in using the Facebook “graph”

You would usually do Facebook functions in a Unity app – iOS 6.0 – using the Prime31 SocialNetworking plugin.

So I want someone to please show here precisely how you would do it.

Pls do not attempt this unless you are totally familiar with Facebook “apps”, the appid / shared secret concept on facebook apps, you must be completely familiar with using Prime31’s SocialNetworking plugin (or at least their other plugins), and of course you are familiar with the joys of the FB “graph” API etc.

Pls note that this has nothing to do with a URL link. In iOS6, users can be logged in to the inherent FB system that is now in iOS on the control panel, and then by using (typically) the Prime31 Plugin, you can then access, with that actual authorized FB user, the FB “graph” - and you can thus directly, within the app, do things like Like buttons (and indeed much much more).

So it will be a nice little but of open source, and if you know what you’re doing claim the reward!!!

Cheers!

#pragma strict

function OnGUI()
	{
	if (GUI.Button(Rect(20,20,1000,100),"FB Like /your FB test site" ))
		YouDidThis();
	}

function YouDidThis()
	{
	Debug.Log(" You add codes here, good luck! ");
	}

Makes me long for the good ole 'stack overflow' days, with their bounty system.

i can't believe it, nobody cares about a $250 cash reward ?! WTH ???!

That's a lot of APIs to be familiar with. Probably not many people know Unity && Prime31 plugins && Facebook apps && the graph API. In my case it's just the first.

I see the reward has gone up $150 in one day, at this rate I am about to wait a few weeks before answering then. Also, I will take a few weeks to figure the answer out...

I asked a Facebook developer rep about this at Casual Connect today and I have good news to report... apparently the ability to "Like" a page/app is in Beta and should be released sometime later this year via the FB Unity plugin.

3 Answers

3

Have you seen any apps that actually do this? Every one I’ve looked at opens up the Facebook page of the item you want to like either inside the facebook app or safari.


The following code will allow you to like objects that facebook allows (this does not include pages or apps).

public void Like(string likeID)
{
   Facebook.instance.graphRequest(
          likeID+"/likes",
          HTTPVerb.POST,
          ( error, obj ) =>
   {
     if (obj != null)
     {
      Prime31.Utils.logObject( obj );
     }
     if( error != null )
     {
      Debug.Log("Error liking:"+error);
      return;
     }
     Debug.Log( "like finished: " );
   });
}

So for example the following will successfully like our upcoming game’s picture:

if (GUILayout.Button( "Like Stuntman Eddie" ) )
{
   Like("563245350362153");
}

however the following will return failure trying to like our company page

if (GUILayout.Button( "Like Tactile Fusion" ) )
{
   Like("447312341955455");
}

If the above are not suitable then you can forcibly open the page in the facebook app it’s self via:

	if (GUILayout.Button( "Open Tactile Fusion Page in FB" ) )
	{
		Application.OpenURL("fb://profile/447312341955455");
	}

Or if you want to open in safari if the facebook app is not installed and the facebook app if it is installed then the following will work, it appears that iOS captures the facebook.com and directs it to the app if installed automatically:

	if (GUILayout.Button( "Open Tactile Fusion Page in safari" ) )
	{
		Application.OpenURL("http://www.facebook.com/447312341955455");
	}

HI @andsee. Are you sure you have iOS6 on the iPad you're checking with? Load almost any current major title -- what about say "temple run brave". Load it, go to the first screen, click the ("woodcut!") FB logo at the bottom right. You can see the whole system. Or, just look at all the Apple doco for the iOS6 facebook "integration", also in your control panel on the iPad you'll see the whole "facebook" integration section (not unlike they added, say, notifications in an earlier era).

I completely understand what you're saying .. fortunately I'm always prepared to be quite wrong! :) https://developers.facebook.com/docs/reference/api/publishing/ stand by ...

Ive stumbled on to considerable evidence that @andsee may be correct (and hence wins the reward ??!) For example ... http://stackoverflow.com/questions/9983296/how-can-i-use-the-facebook-javascript-api-to-automatically-make-a-user-like-a-pa/9986778#9986778

I've been fiddling with this for our project and it does seem that it is not possible for pages. Read more here: http://developers.facebook.com/docs/opengraph/guides/og.likes/ ( exact citation "For Facebook Pages or websites that do not integrate with Facebook Authentication, developers should continue to use the Like button social plugin." ).

I feel andsee has #probably won this challenge... . anyone viewing who cares to comment, feel this is a reasonable and fair decision? 1 - on the face of it he has supplied exactly the code in question. And first. (And only!) 2 - he raised the critical issue that you can't actually Like pages (only posts etc) 3 - he has used his own deep experience to show that (2) is the case, indeed even supplying an example It seems fair to say this human has won -- sounds reasonable to anyone who cares? Thanks !!

I’ve done this from a web application. It’s an app that’s registered in FB and uses FB’s graph to have them like posts and comments from the user’s perspective. The only piece of your equation that I’m not 100% on is prime31, however, after reading the documentation, it seems straightforward. My only question I have is what is the user of your application actually ‘Liking’ when the button is clicked?

hi @Yoki ... I believe you may be the world's leading expert on the issue :) Yes, that is all absolutely correct, and in answer to your question, it's a FB page. So you'd have facebook.com/AmazingGame right? As you well know, that /AmazingGame property would be a facebook "app" at developer-facebook, and of course it would have a control panel .. [9940-fbexamp.png|9940] .. with an app id and shared secret. So that's exactly what you're asking, right? (As a FB developer, you may already have or may want to make a facebook/ExampleThing .) Cheers!

Ah - I've just realised what you said Yoki ... have them like POSTS AND COMMENTS from the user's perspective again this reinforces the notion you can use the API (aka "graph") when authorised / logged-in to "Like" things such as Posts. But a lot of evidence seems to suggest you can't Like a FB page itself.

There’s another excellent plugin for using Facebook with Unity worth checking out:

Also check out the free game server offered by the same vendor.