Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

[Closed] Social Networking Plugin (Facebook and Twitter) live!

Discussion in 'iOS and tvOS' started by prime31, Sep 19, 2010.

  1. junkotron

    junkotron

    Joined:
    Feb 22, 2009
    Posts:
    158
    Is there a quick method that returns the facebook user id? If not, how would I retrieve this with js?
     
  2. prime31

    prime31

    Joined:
    Oct 9, 2008
    Posts:
    6,426
    @junkotron, there is a demonstration of that right in the demo scene.
     
  3. ciaravoh

    ciaravoh

    Joined:
    Dec 16, 2009
    Posts:
    252
    Hi Prime,

    I try to setup twitter with oAuth with no success. The demonstration page is not working with

    Code (csharp):
    1. TwitterBinding.init( "xxxxxxxxxxxxxxxx", "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" );
    the twitter page display and I enter my username and password then I click on "Authorize application" but it gives me this message

    Code (csharp):
    1. 2011-06-29 17:30:08.903 ILeaveThisCompany[1993:707] -[__NSCFSet minusSet:]: This app appears to be calling this method with a non-set parameter.  Please wait while the system corrects this....  
    2. 2011-06-29 17:30:09.289 ILeaveThisCompany[1993:1c43] PIPELINE: logging URLS that fail to support pipelining heuristics
    3. 2011-06-29 17:30:09.292 ILeaveThisCompany[1993:1c43] PIPELINE: Heuristics failed for: ssl.google-analytics.com
    4. 2011-06-29 17:30:45.076 ILeaveThisCompany[1993:707] -[__NSCFSet minusSet:]: This app appears to be calling this method with a non-set parameter.  Please wait while the system corrects this....  
    5. 2011-06-29 17:30:47.398 ILeaveThisCompany[1993:707] -[__NSCFSet minusSet:]: This app appears to be calling this method with a non-set parameter.  Please wait while the system corrects this....  
    6. 2011-06-29 17:31:14.049 ILeaveThisCompany[1993:707] -[__NSCFSet minusSet:]: This app appears to be calling this method with a non-set parameter.  Please wait
    Any idea ?

    I have update to your last version of course.

    thanks.
     
  4. prime31

    prime31

    Joined:
    Oct 9, 2008
    Posts:
    6,426
    @ciarovoh, I have never seen anything like that before. They appear to be generated by the UIWebView. Does your application name and info show up properly on the Twitter login page? Did you try it since then? Twitter is infamous for downtime so it could have been an issue on their servers.
     
  5. ciaravoh

    ciaravoh

    Joined:
    Dec 16, 2009
    Posts:
    252
    Prime,

    After I get the web page, I entered my username and password and clic "authorize". I then get a PIN code (7 digits) and I'm asked to enter this PIN code in to my app to finalize the registration.

    I can't see anywhere in your API where to enter this PIN code. any idea ?

    If I click '"cancel" of course the registration is cancelled.

    thanks

    thanks.
     
  6. ciaravoh

    ciaravoh

    Joined:
    Dec 16, 2009
    Posts:
    252
    Prime,

    just to add. the PIN code is asked when the Application does not suport the full OAuth process. is this the case ?

    Code (csharp):
    1. Out-of-band/PIN Code Authentication
    2. For applications that really can't handle the full OAuth process Twitter provides the out-of-band/PIN code authentication mode, also known as oob.
    3. This authentication flow is almost identical to full OAuth except instead of being directed back to your website the user is presented with a PIN code. The user is then asked to type this PIN code into your application which will then complete the token exchange.
    4. In the full OAuth flow this manual process is performed by the callback URL and transparently to the end user.
     
  7. prime31

    prime31

    Joined:
    Oct 9, 2008
    Posts:
    6,426
    If you are seeing the PIN you didn't setup your app properly on the Twitter website. Check the docs and be sure to setup your app in the proper manner.
     
  8. ciaravoh

    ciaravoh

    Joined:
    Dec 16, 2009
    Posts:
    252
    Hello Prime,

    the document is quite light IMHO. I have setup the app in "website" mode. I left the textfield "Callback URL:" empty as I don't know what to put here and that's it. Nothing more to enter on the App page.

    any idea ?

    thanks
     
  9. prime31

    prime31

    Joined:
    Oct 9, 2008
    Posts:
    6,426
    A blank callback URL ends up reverting your app to a desktop app. From the documentation that you feel is "quite light" ;)

    "If you choose to use oAuth, make sure you setup your app on the Twitter website as a Browser app. You must enter a callback url when registering. It will not be used bit it still needs to be there for authentication to work. The redirect url you put in does not matter as it will not get used."


    On a side note, we strip the docs down to the bare minimum due to the fact that most people won't read them if they look even remotely long.
     
  10. ciaravoh

    ciaravoh

    Joined:
    Dec 16, 2009
    Posts:
    252
    Prime,

    I was refering to the twitter doc, not yours :) All the parameters are not described. We have to guess.

    I'll try to enter something in the callback URL and I'll tell you.

    regards,
     
  11. ciaravoh

    ciaravoh

    Joined:
    Dec 16, 2009
    Posts:
    252
    Prime,

    I have setup : http://127.0.0.1/twitter_prompt/index.php as the callback url.

    I got the following error message with the app tries to come back to my app :


    Code (csharp):
    1. 2011-06-30 21:29:13.339 ILeaveThisCompany[3458:5d2b] PIPELINE: logging URLS that fail to support pipelining heuristics
    2. 2011-06-30 21:29:13.341 ILeaveThisCompany[3458:5d2b] PIPELINE: Heuristics failed for: ssl.google-analytics.com
    3. 2011-06-30 21:29:15.533 ILeaveThisCompany[3458:5d2b] PIPELINE: Heuristics failed for: 127.0.0.1
     
  12. prime31

    prime31

    Joined:
    Oct 9, 2008
    Posts:
    6,426
  13. ciaravoh

    ciaravoh

    Joined:
    Dec 16, 2009
    Posts:
    252
    Prime,

    you did it I just used your dumb URL and it works fine. thank you for your support. you are really quick.

    thanks again.

    hervé
     
  14. iguana_02

    iguana_02

    Joined:
    Apr 22, 2011
    Posts:
    211
    Hi prime, i just bought this plug in today (i think i have almost all your plug ins now!)...

    As usual the first thing i do is export the demo scenes to see the app working

    i tried many times and i obtain 13000 errors...can you tell me what is it and how to fix it please?

    Thank you!

    Iguana

    EDIT: Don't know why but after 10 times now it works...i think is something to do with the postprocessingbuilder...
     
    Last edited: Jul 1, 2011
  15. Malandrin

    Malandrin

    Joined:
    May 6, 2011
    Posts:
    4
    Hi Prime,

    First, sorry for my english, I hope you can understand me. I've just bought the plugin and now I'm trying to integrate twitter on my app. Steps I'm following:

    1.- I've created an application on dev.twitter.com as browser application type, on Callback URL I write my URL (http://www.digitaltentacle.com)

    2.- I insert nerworking package on Unity and add SocialNetworkingEventListener and SocialNetworkingManager prefabs to scene.

    3.- When application started I call TwitterBinding.init( "myconsumerkey", "myconsumersecret" )

    4.- I try to connect to twitter using TwitterBinding.showOauthLoginDialog()

    5.- A windows appears on screen asking me for my user and password. I enter the user and password and the next error is showed:

    "Woah there!
    This page is no longer valid. It looks like someone already used the token information you provided. Please return to the site that sent you to this page and try again... it was probably an honest mistake."

    What are I doing wrong? Thanks!
     
  16. prime31

    prime31

    Joined:
    Oct 9, 2008
    Posts:
    6,426
    @Malandrin, your English is quite good and fully understandable. What it sounds like is that your token from Twitter is expiring rapidly for some reason. On the login page, do you see your apps name properly? If so, try deleting the app from your device and reinstalling. Sometimes during development caches and files don't get properly updated on install.
     
  17. iguana_02

    iguana_02

    Joined:
    Apr 22, 2011
    Posts:
    211
    Hi Prime, the plug in works fantastic and had no problem at all in setting up few minutes and it was working.
    My usual problem is just "paths" anything to do with a "Path" is a kind of curse for me. hehehe..

    Im trying to post an image(from the iPhone Documents folder) on my fb wall but facebook reports that is not formatted properly.
    I tride the following method that is the method i used in any other plug in and worked, but not in this case:

    FacebookBinding.showPostMessageDialogWithOptions( "Test", "http://xxxcom", "xxx LTD", Application.persistentDataPath+"/Screenshot.png", "Picture taken with xxx app" );

    I tried posting an online image and it works...so its obviously a problem about the path.

    Can you please tell me how the address for an "Internal" image should be?

    After this let's try with the Twitter part..heeehhe.

    Cheers,
    Iguana.
     
  18. Malandrin

    Malandrin

    Joined:
    May 6, 2011
    Posts:
    4
    @Prime, it's works! thanks :)
     
  19. prime31

    prime31

    Joined:
    Oct 9, 2008
    Posts:
    6,426
    @iguana, the method you are using only works with a link to an image. There is a different method that will actually take a raw image and upload it. I believe it is called postImage.
     
  20. iguana_02

    iguana_02

    Joined:
    Apr 22, 2011
    Posts:
    211
    Thank you Prime, i going to check now! :)
     
  21. iguana_02

    iguana_02

    Joined:
    Apr 22, 2011
    Posts:
    211
    Hi Prime,
    i tried but seems nothing happens...

    FacebookBinding.postImage( Application.persistentDataPath+"/Screenshot.png", "Picture taken with xxx app" );

    i click on the button and after a short pause, nothing happens.

    I would like to do like: FacebookBinding.showPostMessageDialogWithMessage it opens a pop up (fantastic) with Facebook Interface but with my picture (inside my iphone) instead of a picture from the internet.

    it is possible to do?
     
  22. Pixeye

    Pixeye

    Joined:
    Jul 2, 2011
    Posts:
    195
    Hi Prime!

    First of all tnx for nice plugin, i've managed to setup it for facebook and it works just great! but im having troubles with twitter.

    Im using Oauth login and when i tap to login, twitter show me that "page is unavailable, perhaps someone used your key before" something like that, ( my twitter gave me this message not in english language, so i tried to translate as clear as i could )

    debug log
    2011-07-02 19:52:02.330 PROGRAMMBLABLABLA[984:707] got reqeust token

    I ve made an app in twitter as u said ( browser app with fake link ).

    What can i do?

    PS, no offence, but docs on your site a little bit "light", i had to look up on forums while having some problems with facebook connection. Perhaps it would be great to make sort of list with most common issues and bugs, and ways to get rid of them.

    PSPS, sorry for my poor english, not native speaker, hope that everything is clear;-)
     
  23. prime31

    prime31

    Joined:
    Oct 9, 2008
    Posts:
    6,426
    @iguana, Facebook doesn't offer any dialogs that accept raw images. Are you certain the image didn't get uploaded? You should always get either the success or failed event in all circumstances.

    @pixeye, we purposely do not fully document certain things that are best served from the originating source: Facebook and Twitter in this case. If we duplicated all their documentation we would then have to keep ours and theirs up to date which isn't feasible. To fix your issue first ensure you have only one app installed on your device with that bundle identifier. Next, delete it from your device then run it from Xcode. Also ensure your callback url is a valid url. It doesn't have to be real though. http://www.stuff.com/ would work fine for example.
     
  24. iguana_02

    iguana_02

    Joined:
    Apr 22, 2011
    Posts:
    211
    Hi Prime,
    i tried many times..it does a short delay and nothing else happens.

    I'm sure is something to do with the login or something...
    The other features works fine, it goes and back from and to safari etc. This is the entire script for my button:

    public void onTouchUpInsideFacebookButton( UIButton sender )
    {
    // Facebook function
    FacebookBinding.init( "00000000000000" );
    FacebookBinding.postImage( Application.persistentDataPath+"/Screenshot.png", "Picture taken with xxx app" );

    obviously the init is a dummy one not the real...:)

    }
     
  25. Pixeye

    Pixeye

    Joined:
    Jul 2, 2011
    Posts:
    195
    nope - didnt help, i ve even tried making other unity project and making other app in twitt, didnt helped
     
  26. prime31

    prime31

    Joined:
    Oct 9, 2008
    Posts:
    6,426
    @iguana, I don't see any event listeners in your code. Put the EventListener prefab in your scene and it will log some data that will let you know if it succeeds or fails. I'm guessing you are gonna have a mobile uploads album with a bunch of your test image in it.

    @pixeye, what is the callback URL you are using? It seems like either Twitter is giving you expired tokens or there may be an issue with the callback URL.
     
  27. Pixeye

    Pixeye

    Joined:
    Jul 2, 2011
    Posts:
    195
    http://www.stuff.com/ as a callback

    by the way - full message what im getting on


    This page is no longer valid. It looks like someone already used the token information you provided. Please return to the site that sent you to this page and try again

    funny thing - when i used ( just for test ) LETS TWEET from unity store - it worked. ( not on iphone, ive launched it fro editor ) but it worked
     
    Last edited: Jul 2, 2011
  28. iguana_02

    iguana_02

    Joined:
    Apr 22, 2011
    Posts:
    211
    Hi Prime,
    sorry but i cn't find any evel listener for postimage method, i opened the manager as well as the evenlistener but not trace of it.
    I tried to put an event inside any listened event (error page) but its still doing the same thing, pause and then nothing.
    I opened my facebook page and there are no mobile uploads.

    Its very strange, no errors, no uploads, nothing.
    If i use the FacebookBinding.showPostMessageDialogWithOptions it works fantastic but i can't upload my image if i use post image is not working at all...is that possible to mix the things, insert my image inside FacebookBinding.showPostMessageDialogWithOptions?
     
  29. prime31

    prime31

    Joined:
    Oct 9, 2008
    Posts:
    6,426
    @pixeye, if you could send me your Twitter information in a PM I can try to duplicate what you are seeing. My test accounts all work as planned.

    @iguana, there is no specific post image events. All of Facebooks advanced API calls use the custom event. If you put the EventListenwr prefab in your scene it listens for and logs every event to the console.
     
  30. Deleted User

    Deleted User

    Guest

    Just a suggestion - I started looking at the LinkedIn API and maybe that would be a good addition to this plugin (also uses oAuth)
     
  31. prime31

    prime31

    Joined:
    Oct 9, 2008
    Posts:
    6,426
    @technicat, if we get enough requests we will make just about anything. LinkedIn and games are two things you really don't see together often though.
     
  32. iguana_02

    iguana_02

    Joined:
    Apr 22, 2011
    Posts:
    211
    HI Prime,
    I tried to put some Alert pop up on the event listener (all the events) so now i know everything that happens.

    I tried to use your demo scenes with my FB ID and it works
    It goes on safari, it says that "i have already registered the app" and it goes back i open FB on my mac and the post (text) is there.

    With mine i always have a strange situation.
    It goes on safari, it says that "i have already registered the app" and it goes back ii got my alert pop up with "POST FAILED" because i wrote it on the postfail listener.

    The pList is fine (is the same for both apps...
    I assume i don't have errors on the postImage because i have no listenere so for now i use a normal post (text).

    Any clue of what i'm doing wrong?

    Thanks

    Iguana
     
  33. prime31

    prime31

    Joined:
    Oct 9, 2008
    Posts:
    6,426
    @iguana, so if it works with the demo scene and not with yours I would start checking for differences between them. The plist is easy to tell if it is working and yours definitely is so just check for code differences.
     
  34. iguana_02

    iguana_02

    Joined:
    Apr 22, 2011
    Posts:
    211
    You're completeley right Prime but its really frustrating, both look the same with the same script, but mine is not working.

    The only difference between the two projects is the use of the other plug ins (etcetera 1,2 and Nativetoolkit)...colud be a compatibilty issue?
    Maybe one of the plug ins is writing something on the code or the plist?

    EDIT: Apparently the reason is not posting with my app is because after the log in when it goes back to my app.....is not logged in...
     
    Last edited: Jul 3, 2011
  35. iguana_02

    iguana_02

    Joined:
    Apr 22, 2011
    Posts:
    211
    Prime 31, i found the problem...
    its the AR engine in unity...seems that everything you go out of the app (in this case you log in in safari) it pauses the game and when you go back to the app it starts to play again but without the log in info.

    Is there a way to log in inside the app? I know is not a problem with your plug in but would be cool if i manage to do it inside the app.

    I cant touch the AR plug in...is impossible.

    Thank you for your help!

    iguana

    EDIT: DONE! Its working now, i had to put 1 second delay before posting to jump the pause.
     
    Last edited: Jul 4, 2011
  36. TaintedLemon

    TaintedLemon

    Joined:
    May 4, 2011
    Posts:
    16
    @Prime31 / @Pixeye

    I'm having the same issue as Pixeye

    "Woah there!
    This page is no longer valid. It looks like someone already used the token information you provided"

    Did you find a solution to the problem?
     
  37. prime31

    prime31

    Joined:
    Oct 9, 2008
    Posts:
    6,426
    @Tainted, I have not been able to reproduce the issue. Double check all your setup on the Twitter website and if you have everything setup properly and can reproduce the issue using the demo scene feel free to email (questions [at] prime31.com) over your Twitter id and secret and I'll give it a look.
     
  38. TaintedLemon

    TaintedLemon

    Joined:
    May 4, 2011
    Posts:
    16
    Argh Consumer Secret was wrong by one letter! Guess I was just put off by the lack of a decent error message from twitter telling me as much. Don't know if pixeye has the same problem but it's worth a quick triple check.
     
  39. zehreken

    zehreken

    Joined:
    Jun 29, 2009
    Posts:
    112
    Hello Prime,
    I'm having problems getting the logged in user's name, I'm not familiar with event and delegates, this is the code I use;

    and I get nothing, I'm sure that I'm logged in.
     
  40. prime31

    prime31

    Joined:
    Oct 9, 2008
    Posts:
    6,426
    @zehr, if you go to the documentation page there are tutorial videos on the top. One is on events and delegates and I highly recommend you first watch it. Each plugin comes with an EventListener prefab that demonstrates how to listen to every event the plugin uses. It is a good template for your own event handlers.
     
  41. zehreken

    zehreken

    Joined:
    Jun 29, 2009
    Posts:
    112
    Thanks prime, I really appreciate your help. The video tutorials are great.
     
  42. irondog

    irondog

    Joined:
    Jun 21, 2011
    Posts:
    35
    How do I grab friends who use the app?

    Its not available using the GraphAPI and everyone is saying use the old API.

    Thoughts?

    Ashley.
     
  43. nsiomos

    nsiomos

    Joined:
    Jul 25, 2011
    Posts:
    24
    Hi Prime,

    I bought the Social Networking plugin some days ago and it works very well so far -- good job!

    one question though: is it somehow possible to have a facebook login just like twitter's xauth, i.e. without leaving the app for Safari's authentication dialog?
     
  44. prime31

    prime31

    Joined:
    Oct 9, 2008
    Posts:
    6,426
    Nsiomos, Facebook is moving all their logins to single sign on so as long as the Facebook app is installed it is used to authenticate.
     
  45. Jay_Santos

    Jay_Santos

    Joined:
    May 31, 2011
    Posts:
    42
    @Prime31 - Prime, I am interested in your social media plugin but I have a question:

    - Specifically for Twitter: You said you use xAuth, does that mean that all the user needs to do to, say, post a score on twitter is input his username and password and press a "Submit" button and that's it? Does your plugin store the credentials or only the access token?

    Thanks in advance,

    Jay_Santos
     
  46. nsiomos

    nsiomos

    Joined:
    Jul 25, 2011
    Posts:
    24
    Hi Prime

    here's an issue I encountered:
    when using FacebookBinding.postMessage(), a message appears on the user's wall and also on the user's and his friends' news stream.
    However, when using postMessageWithLinkAndLinkToImage() or showPostMessageDialogWithOptions(), the generated post only appears to the user's wall, and not on the news stream of the user or his friends.

    I'd really like to use the latter methods, because they allow posting images along with a message, but why are they considered so "private" in facebook?
     
  47. code749

    code749

    Joined:
    Jan 17, 2009
    Posts:
    100
    is it possible to get the user to hit the 'like' button from within the game ui

    like add a like button in the main menu of the game of something
    and this post to the user's facebook page
     
  48. prime31

    prime31

    Joined:
    Oct 9, 2008
    Posts:
    6,426
    @nsiomos, as far as I know that is the intended behavior. Those methods are from the Facebook SDK directly so if you feel they are not correct you will need to open a bug with Facebook.

    @code749, I don't know for sure but if it is possible it will more than likely be in the Graph API docs.
     
    Last edited: Aug 6, 2011
  49. nsiomos

    nsiomos

    Joined:
    Jul 25, 2011
    Posts:
    24
    I did a little bit more testing, and apparently the posts ultimately do show up in the news feed, but for me it was delayed non-deterministically and up to a day... ;(
    so, with the plugin everything is fine -- just facebook messed up with my posts...
     
  50. Jay_Santos

    Jay_Santos

    Joined:
    May 31, 2011
    Posts:
    42
    Hi Prime, can you answer my question as well?

    - Specifically for Twitter: You said you use xAuth, does that mean that all the user needs to do to, say, post a score on twitter is input his username and password and press a "Submit" button and that's it? Does your plugin store the credentials or only the access token?

    Thanks again,

    Jay_Santos