@sonicviz, almost all of the Facebook methods are asynchronous so you will need to listen to the completion events to know when they are done. The SocialNetworkingEventListener.cs file has examples for how to listen to every available event in the plugin. The 2 you are interested in can be listened to like this:
- void Start()
- // Start listening to the events
- SocialNetworkingManager.facebookLogin += facebookLogin;
- SocialNetworkingManager.facebookLoginFailed += facebookLoginFailed;
- // Stop listening to the events
- SocialNetworkingManager.facebookLogin -= facebookLogin;
- SocialNetworkingManager.facebookLoginFailed -= facebookLoginFailed;
- void facebookLogin()
- void facebookLoginFailed( string error )
Prime, i'm a little new to C# and never saw "Events" or "Delegates" before, i figured out how to get the userName from Facebook but i do not know how to check if i'm logged in
It works fine:
SocialNetworkingManager.facebookReceivedUsername += delegate(string result)
texto.text = "Welcome " + result;
but them comes:
SocialNetworkingManager.facebookLogin += ?????
and i do not know what to do
Thanks Prime! Got it figured out now. Twitter just gave me xAuth approval too. A little more involved than getting FB approval, but aok in the end.@sonicviz, almost all of the Facebook methods are asynchronous so you will need to listen to the completion events to know when they are done. The SocialNetworkingEventListener.cs file has examples for how to listen to every available event in the plugin. The 2 you are interested in can be listened to like this:
this plugin support the new fb single sign-on functionality? http://developers.facebook.com/docs/guides/mobile/
Also does it support the full graph api calls. Im curious how you build a web or html page on top of unity to allow for proper authorization, with the handshaking of OAuth, the fb uid (which I guess will be encrypted soon) etc
@gateway69, the plugin exposes a method (graphRequest) that allows you to make just about any graph API request. All the auth happens through the standard Facebook Connect iOS web views which then uses OAuth to make all the requests.
I'm wondering how you can get facebook posts to show up on the news feed / stream and not just on the users wall?
@Tagged, you would have to check the Graph API soca for that one. I am not familiar with everything that it exposes. There is a TON available.
Thanks for the quick reply!
Been trying to figure it out for a few hours with luck.. If anyone else stumbles on the answer would be very appreciative. Will continue to search otherwise and post if I manage to figure it out.
Awesome plug-in btw
Prime31, whats the correct way to build my project? Sometimes i get some errors in Xcode and have to rebuild all
@Paulo, as long as you don't use Build and Run from Unity you should be fine. If you do accidentally do a Build and Run close Xcode, then do a Build followed by a Replace in Unity to rebuild the Xcode project.
Prime, i'm still taming your script hehe, sorry for the amount of posts,
I saw in some games that uses your plugin that when i left the game, open it again and try to login it auto-connect, without the need of email or pass, how can i do that?
@Paulo, that will all happen automatically as long as a valid token is still around. You can also use the isLoggedIn method to check manually.
Prime, i cant find this:
// Shows a dialog allowing a user to edit the message with a link, a name for the link, a link to an image and a caption for the image
public static void showPostMessageDialogWithMessageAndLinkAndLinkToIm age( string message, string link, string linkName, string linkToImage, string caption )
@Paulo, it looks like the docs weren't updated with the new name for that method: showPostMessageDialogWithOptions
I just updated the docs to correct the misnamed method.
Prime, just need a little guidance here (sorry if this is a really basic/obvious answer).
I tracked down an issue with how facebook handles mobile cookies, something to do with logging in multiple ways which I assume is safari and the native facebook app. It spits out an Error 110 when trying to post to a wall because the cookie has been invalidated. Is there a way to detect an invalid cookie login prior to calling showPostMessageDialogWithOptions ? I'm using isLoggedIn already and that comes back as true even with an invalid cookie. Right now to avoid this I'm simply logging out and in each time, which would be annoying for the user!