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. ciaravoh

    ciaravoh

    Joined:
    Dec 16, 2009
    Posts:
    252
    @unseenthings : I'm not sure why you still have this error. Can you copy here the lines of code you are using to connect to fb ?
     
  2. unseenthings

    unseenthings

    Joined:
    Nov 12, 2009
    Posts:
    32
    Well, I've tried a number of different things -- from FacebookBinding.login() to your code:
    Code (csharp):
    1.             string[] sAut = new string[] {"publish_stream", "offline_access"};
    2.             FacebookBinding.loginWithRequestedPermissions(sAut);
    3.  
    I know that you cannot authorize the app with "login" and then try to access it with that "login with requested permissions" and stuff like that... was there not an "a ha!" moment with yours when you realize what had gone wrong?
     
  3. ciaravoh

    ciaravoh

    Joined:
    Dec 16, 2009
    Posts:
    252
    @unseenthing : it went fine when I switch to that mode (not using Login() anymore). Please also make sure you got the 'fb' in front of your plist entry.
     
  4. unseenthings

    unseenthings

    Joined:
    Nov 12, 2009
    Posts:
    32
    Okay. Yeah, I'm doing both of those. Did you do anything special on the FB side to the app settings? Did you put your bundle ID in there and all that?
     
  5. squidbot

    squidbot

    Joined:
    Jan 4, 2011
    Posts:
    128
    "facebookErrDomain" sounds like your plist entry is not correct? Can you post the contents of Assets/Prime31/plistAdditions.plist
     
  6. ciaravoh

    ciaravoh

    Joined:
    Dec 16, 2009
    Posts:
    252
    CFBundle URLSchemes must contains 1 entry for SSO. Make sure you have the 'fb' in front of your appID.
    Nothing special to report on the application creation. Just the default.

    Also don't need to check the Token if you just want to post to your wall. the Tokens are used for special rights only (If I'm not completely wrong).
     
  7. LAW_MAX

    LAW_MAX

    Joined:
    May 13, 2011
    Posts:
    1
    I have the following problem:

    - An App wich posts the score with a brag message.
    - I used the showPostMessageDialogWithOptions method in facebook binding.
    -The message, caption and link appear correctly.

    But the image only appear approximately every 3rd time I call thes howPostMessageDialogWithOptions method.
    The link is correct, via browser the correct image appears.

    The Image is 90x90 pixels large and .png format.
     
    Last edited: May 13, 2011
  8. prime31

    prime31

    Joined:
    Oct 9, 2008
    Posts:
    6,426
    @LAW, that sounds like a bug for the Facebook guys. There isn't anything I can do from my end for that
     
  9. J_P_

    J_P_

    Joined:
    Jan 9, 2010
    Posts:
    1,027
    Any updates on this? I'm planning to buy/use the plugin for Twitter :)
     
  10. prime31

    prime31

    Joined:
    Oct 9, 2008
    Posts:
    6,426
    @Jtown, Twitters latest news is that Oauth is required for DM access as of June 14th. Xauth access will continue to be allowed for everything else so all should be fine.
     
  11. J_P_

    J_P_

    Joined:
    Jan 9, 2010
    Posts:
    1,027
    Just got approved for xAuth and will buy the plugin soon so I can start testing. Now I need to figure out how I'm going to format my messages. I was thinking something like "Beat level 12 in #FishMoto for iPhone with a time of 00:47.86"
     
  12. prime31

    prime31

    Joined:
    Oct 9, 2008
    Posts:
    6,426
    @Jtown, don't forget a shortened link back to either your website or the App Store
     
  13. J_P_

    J_P_

    Joined:
    Jan 9, 2010
    Posts:
    1,027
    Ah! Good idea!
     
  14. Captnian_legacy

    Captnian_legacy

    Joined:
    Aug 14, 2008
    Posts:
    25
    Hi Prime31 - love your plugin and the support you offer - great product. I'm wondering if the Social Networking Plugin can bring up the Facebook Application Request dialog box. For example, in javascript in a webpage I can bring it up with:

    function sendRequest() {
    FB.ui({
    method: 'apprequests',
    message: 'Check out this application!',
    title: 'Sendyour friends an application request', ​
    })
    }

    I realize however that according to the documentation at:

    http://developers.facebook.com/docs/reference/dialogs/requests/

    the return value sends you to the canvas page with a parameter of request_ids. So, not sure if this would work anyway?


    I guess I should start with what we're trying to do :) We want to be able to allow the user to invite their friends to our app/game from the iOS device. Is this even possible?

    Thanks for all your help!

    -Ian
     
  15. prime31

    prime31

    Joined:
    Oct 9, 2008
    Posts:
    6,426
    @Ian, the JS API is very, very different from Facebook Connect (the Obj-C API). The plugin will get you full access to the GraphAPI also so you can definitely grab friends and send off invites (that is all part of the GraphAPI). The term the plugin (and Facebook Connect) uses is dialogs. They are similar to the JS ones but not exactly the same.
     
  16. probbins

    probbins

    Joined:
    Oct 19, 2010
    Posts:
    216
    Hey Prime31,

    Can we allow player's playing our game automatically like and post achievements to our Facebook page opposed to their own Facebook page or both?
     
  17. prime31

    prime31

    Joined:
    Oct 9, 2008
    Posts:
    6,426
    @Pip, I believe that is all possible with the GraphAPI. You will want to double check on Facebook's documentation page though.
     
  18. hxx2010

    hxx2010

    Joined:
    Aug 31, 2009
    Posts:
    155
    Ask how to set this access, thank you
    facebook.com/"gameName"
     

    Attached Files:

  19. prime31

    prime31

    Joined:
    Oct 9, 2008
    Posts:
    6,426
    @hxx, you will have to consult Facebooks documentation. The plugin has nothing to do with setting up and using Facebook app pages.
     
  20. tobephong

    tobephong

    Joined:
    Oct 2, 2009
    Posts:
    15
    prime31,

    From you sample scripts: TwitterBinding.login("REPLACE_WITH_YOUR_INFO","REPLACE_WITH_YOUR_INFO");

    what do I put in "REPLACE_WITH_YOUR_INFO", "REPLACE_WITH_YOUR_INFO"?
     
  21. DarkJedi

    DarkJedi

    Joined:
    Apr 15, 2009
    Posts:
    48
    Have a quick look at the docs for the plugin here - http://prime31.com/unity/docs/#socialDoc

    You'll see a handy list of the functions that TwitterBinding.cs exposes. For example:
    Code (csharp):
    1. // Logs in the user using xAuth
    2. public static void login( string username, string password )
    ...should help a little :)

    Note that as well as calling that function your code will need to listen for the SocialNetworking.twitterLogin and SocialNetworking.twitterLoginFailed events and act accordingly, as this stuff works asynchronously.

    If this is your first foray into event handling you might want to watch prime31's tutorial video here http://www.youtube.com/watch?v=N2zdwKIsXJs

    HTH,
    Dan
     
  22. tobephong

    tobephong

    Joined:
    Oct 2, 2009
    Posts:
    15
    Thank you for the help. Actually, I did follow the documentation. I got facebook to work just fine. When it come to the twitter portion, thing seems a little different. I was able to post to Twitter when I manually add a username and password to the TwitterBinding.login("","") in my scripts. But that is not what i want. I want the player to enter the username and password if he/she is not login. After login, the player can post a tweet to his/her account. Am I missing something?

     
  23. DarkJedi

    DarkJedi

    Joined:
    Apr 15, 2009
    Posts:
    48
    Gotcha - I guessed poorly how far along the process of using these plugins you were, sorry! ;)

    The Facebook login is super easy because their official SDK (which Prime31 interfaces with) already provides all the necessary prompts for users to enter their credentials with.

    Sadly, Twitter does not provide us with similar functionality. You have to prompt the user for their username and password natively within your app instead (or perhaps use the showPromptWithTwoFields function from the etcetera plugin if you have that)
     
  24. tobephong

    tobephong

    Joined:
    Oct 2, 2009
    Posts:
    15
    Cool! I will tried that with the etcetera plugin. Thank you for the suggestions.


     
  25. shadowfork

    shadowfork

    Joined:
    Jan 8, 2010
    Posts:
    167
    I just don't understand when I create a button for Logging In, it gets out of the app and doesn't get back right after you allow it. It gets stuck on the Facebook app.

    I open back my app and it will do the same thing over again.

    I tried both methods and get the same results:
    - public static void login()
    - public static void loginWithRequestedPermissions( string[] permissions )

    Any suggestions?
     
  26. prime31

    prime31

    Joined:
    Oct 9, 2008
    Posts:
    6,426
    @shadowfork, sounds like you didnt setup your Info.plist to have a proper url for your app.

     
  27. shadowfork

    shadowfork

    Joined:
    Jan 8, 2010
    Posts:
    167
    I believe I have it setup just fine because I can send post and images in the game.

    But right now I'm on my Options scene where I check if they are logged in or not. If not, I try to launch either of the two methods I mentioned above.

    But I can't get them to work :(

    I have my FacebookBinding.init(); and the 2 prefabs (EventListener, NEtworking Manager) on the scene.
     
    Last edited: Jun 8, 2011
  28. prime31

    prime31

    Joined:
    Oct 9, 2008
    Posts:
    6,426
    @shadowfork, sending a post has nothing at all to do with setting up the Info.plist url scheme. Watch the video and ensure that your Info.plist is setup correctly. The Facebook app cannot return control to your app unless it is setup properly.
     
  29. shadowfork

    shadowfork

    Joined:
    Jan 8, 2010
    Posts:
    167
    I checked the info.plist and the URL scheme is definitely there ("fb00myappnumber00"). I also checked with the Prime31 dialog box and the URL scheme is correct... with the 'fb' padding before the number.

    I get the message: "You have already authorized AppName. Press "Okay" to continue."

    I press "Okay", it rolls down that notice window but it stays on the facebook app (showing news feed, profile, etc.)

    If the numbers were incorrect, i don't think it will say that i have authorized my AppName before, no?
     
  30. prime31

    prime31

    Joined:
    Oct 9, 2008
    Posts:
    6,426
    @shadowfork, authorizing your app also has nothing at all to do with the Info.plist changes. They are literally only used to allow another app to open yours. If you are 100% positive your Info.plist is setup correctly try deleting the app from your device then reinstall it. Oftentimes Xcode does not properly copy over updated Info.plist files.
     
  31. shadowfork

    shadowfork

    Joined:
    Jan 8, 2010
    Posts:
    167
    Didn't work. I'll try re-installing the plugin. (cross fingers).

    Just a thought, is there something in the facebook developer page settings that triggers this behaviour?
     
  32. prime31

    prime31

    Joined:
    Oct 9, 2008
    Posts:
    6,426
    @shadowfork, it is possible though I can't say for sure. I have never looked through their developer page besides the 'add an application' page
     
  33. shadowfork

    shadowfork

    Joined:
    Jan 8, 2010
    Posts:
    167
    It works now. Yey! Thanks Prime! Re-installing the plugin fixed it.
     
  34. qamarzaman

    qamarzaman

    Joined:
    Jul 1, 2010
    Posts:
    85

    Hi Prime
    What about the twitter......... they don't enable the twitter app for x_auth
     
  35. prime31

    prime31

    Joined:
    Oct 9, 2008
    Posts:
    6,426
    @qamarzaman, the plugin supports both xAuth and oAuth. If they dont approve you just use oAuth.
     
  36. qamarzaman

    qamarzaman

    Joined:
    Jul 1, 2010
    Posts:
    85
    Prime
    I have downloaded the plaugin a long ago and integrated it. do i need to re-download it from link you sent me? And integrate again in my project.
     
  37. prime31

    prime31

    Joined:
    Oct 9, 2008
    Posts:
    6,426
    @qamarzaman, yes. You should have received an email about the update last week at the email address you have on file with PayPal. Just use your original download link and reimport to your project.
     
  38. Masashi-Wada

    Masashi-Wada

    Joined:
    Jul 6, 2010
    Posts:
    87
    Hi Prime.

    We are interested in your Social Networking Plugin (both iOS and Android).
    Since our application is the Japanese language, I would like to display in Japanese on both dialogs and messages.
    Is these plug-in supporting unicode characters?
     
  39. prime31

    prime31

    Joined:
    Oct 9, 2008
    Posts:
    6,426
    @Masashi, the dialogs from the plugin run off of Twitters and Facebooks servers. You will have to check with them to see if they are localized.
     
  40. kjetilh

    kjetilh

    Joined:
    Oct 1, 2010
    Posts:
    82
    I first setup an app in facebook devpage, and I was able to post messages and images fine.
    However, after a few days I got a mail from facebook where my app had been disabled because automated systems for some reason had detected negative user feedback.

    Anyway, I registered a new app in facebook, so I got a new ID.
    The problem is that now I'm not able to post images. Messages work fine, but not the postimage method.
    This worked before, and now, with the same app (just a new ID), it does not work anymore.

    I don't get any error messages in the xcode log.

    And here's some of the code. It's just a test where I same a texture to file, and then post it to facebook
    Code (csharp):
    1.  
    2. if( GUI.Button( new Rect( xPos, yPos += heightPlus, width, buttonHeight ), "Save Image to disk" ) )
    3. {
    4.     folderPath = System.Environment.GetFolderPath(System.Environment.SpecialFolder.Personal);
    5.     System.IO.File.WriteAllBytes(folderPath + @"/mytestimage.png", tex.EncodeToPNG());
    6. }  
    7.        
    8. if( GUI.Button( new Rect( xPos, yPos += heightPlus, width, buttonHeight ), "Post Image Message" ) )
    9. {
    10.     FacebookBinding.postImage(folderPath + @"/mytestimage.png", "http://www.blinkstudios.no");
    11. }
    This used to work, now it does not. :/ Any ideas guys?

    Thanks a bunch!

    Kjetil
     
  41. ForrestX

    ForrestX

    Joined:
    Apr 17, 2010
    Posts:
    94
    Are you able to post simple messages?
     
  42. kjetilh

    kjetilh

    Joined:
    Oct 1, 2010
    Posts:
    82
    yep, simple messages work fine.
     
  43. kjetilh

    kjetilh

    Joined:
    Oct 1, 2010
    Posts:
    82
    I also now tried the following

    FacebookBinding.postMessageWithLinkAndLinkToImage("The message", "http;//www.somewhere.no", "somewhere",
    "http://www.somewebsite.com/someimage.jpg", "Image link");

    This fails with error message

    "facebookErrDomain error 10000"

    A bit frustrating this, since I thought I had this working fine.
     
  44. ForrestX

    ForrestX

    Joined:
    Apr 17, 2010
    Posts:
    94
    did you check inside the facebook album?
    maybe fb just didn't make the post...
     
  45. ForrestX

    ForrestX

    Joined:
    Apr 17, 2010
    Posts:
    94
    usually it happens when you use Buld and Run inside unity...
    it happened to me very often...
    the only solution is removing the prime plugins and installing again..
    from now on I suggest using "Build" only...
     
  46. kjetilh

    kjetilh

    Joined:
    Oct 1, 2010
    Posts:
    82
    Thanks for the suggestion, but no, nothing in the album either. Simple message worked fine. hm.
     
  47. kjetilh

    kjetilh

    Joined:
    Oct 1, 2010
    Posts:
    82
    I always build using Build only. I build to a separate folder each time. I didnt really change anything inside the xcode project. I close xcode, hit Build, wait for the prime processor to do its thing, then click Build and Run in XCode.
     
  48. ForrestX

    ForrestX

    Joined:
    Apr 17, 2010
    Posts:
    94
    btw in my experience when that happens, removing the xcode project folder is useless...
    I have to remove the plugin and installa again..I really don't know why it happens..
     
  49. prime31

    prime31

    Joined:
    Oct 9, 2008
    Posts:
    6,426
    Kjetil, your code looks fine. I am wondering if perhaps your entire dev account on the Facebook servers has been limited due to the previous issue. Try shooting them an email to see if they can clear up your account.
     
  50. kjetilh

    kjetilh

    Joined:
    Oct 1, 2010
    Posts:
    82
    Thanks a bunch. I'll do that.