Search Unity

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

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

  1. prime31

    prime31

    Joined:
    Oct 9, 2008
    Posts:
    6,426
    @opsive, I can't think of any reason that wouldn't work immediately but just in case have you tried giving it a short delay before showing the dialog?

    @jerotas, I usually just stick an id from a random App Store app in there when setting it up.
     
  2. opsive

    opsive

    Joined:
    Mar 15, 2010
    Posts:
    5,127
    Yes, I did try giving it a delay. Unfortunately that didn't work either - I still got error -999 after the first login and up to a 5 second delay.

    I was looking through the Facebook code, and in the login dialog you are specifically ignoring error -999 and 102. But in the normal dialog you are only ignoring 102. Is there a reason why those don't match? I put the check against -999 in the normal dialog and now it works fine... but I don't want to keep it in there if there is a reason why you left error -999 out.
     
  3. prime31

    prime31

    Joined:
    Oct 9, 2008
    Posts:
    6,426
    @opsive, that isn't us ignoring the error, it is Facebook. We don't have any knowledge of what their internal error codes are so it's hard to say if it's safe or not.
     
  4. andymads

    andymads

    Joined:
    Jun 16, 2011
    Posts:
    1,614
    @Prime31, I have another external plugin that makes makes plist URL scheme modifications via a PostprocessBuildPlayer script. Note that I have contacted the plugin vendor too.

    The other script does this when used alone:

    $adx_only.png

    If I make sure that the other script runs first, then it looks like yours overwrites its modifications.

    $adx_before_social.png

    Should your script append rather than replace?

    If I run your script first then I do at least get both schemes, but not the URL identifier.

    $social_before_adx.png



    What do you expect to see under 'URL types' when multiple schemes are required? Should there be a new top-level item?

    Basically, what is the correct end result when both scripts have executed?

    EDIT:

    Something like this (created by hand)?

    $adx_and_social_good.png
     
    Last edited: Mar 29, 2012
  5. prime31

    prime31

    Joined:
    Oct 9, 2008
    Posts:
    6,426
    @andy, it is an array so there can be only one top level item. You may just want to set it up by hand and then only do append builds to keep things simple.
     
  6. andymads

    andymads

    Joined:
    Jun 16, 2011
    Posts:
    1,614
    Sorry, when I say "top level item" I was referring to the Item(s) under CFBundleURLTypes rather than the Item(s) under CFBundleURLSchemes.

    Surely your script needs fixing if it wipes existing settings?
     
  7. prime31

    prime31

    Joined:
    Oct 9, 2008
    Posts:
    6,426
    @andy, there is no requirement to use the script. It is provided as a convenience. If you set a URL sceme it will overwrite the array with whatever you set. If that behavior doesn't work for your use case you can modify the URL schemes quite easily right in Xcode.
     
  8. jerotas

    jerotas

    Joined:
    Sep 4, 2011
    Posts:
    5,572
    Ok Prime31, I was posting on another thread about all your plugins, this thread is for the plugin I'm struggling with right now. Anywho I got the Facebook events working. Now the problem I'm having is I can't seem to figure out how to post an image to my Wall with a screenshot of when I die in the game...the problem seems to be that Application.CaptureScreenshot runs asynchronously. So If the next line of code after the capture tries to post it, it isn't there yet. The xCode console is telling me this. How to solve this? Is there some sort of event to listen for when the image is available?

    This does not work:

    Application.CaptureScreenshot(SCREEN_SHOT_FILE_NAME);
    var pathToImage = Application.persistentDataPath + "/" + SCREEN_SHOT_FILE_NAME;
    FacebookBinding.postImage( pathToImage, "Look at my high score!" );

    Thanks if anyone has figured this out.
    -Brian
     
  9. prime31

    prime31

    Joined:
    Oct 9, 2008
    Posts:
    6,426
    @jerotas, Application.CaptureScreenshot has no event for completion. What I usually do is poll with File.Exists until it's ready.
     
  10. andymads

    andymads

    Joined:
    Jun 16, 2011
    Posts:
    1,614
    @Prime31, would this have been the reason why postStatusUpdate( string status, string pathToImage ) never worked until I installed the app on the device and logged in? I never had a problem with postStatusUpdate( string status ).
     
  11. prime31

    prime31

    Joined:
    Oct 9, 2008
    Posts:
    6,426
    @andy, it is possible depending in the settings on the Twitter website for the user.
     
  12. renman3000

    renman3000

    Joined:
    Nov 7, 2011
    Posts:
    6,697
    Hi there I am new to this plug in and have a few questions.

    I want to publish to Facebook, so what are the steps I follow?

    What I know is this....
    set up Facebook dev account.

    What I dont know is...
    where do I store the FacebookBinding.cs file?
     
  13. prime31

    prime31

    Joined:
    Oct 9, 2008
    Posts:
    6,426
    @renman, it doesn't matter where you put the plugin files. You can leave them where they are or move them elsewhere in your project.
     
  14. jerotas

    jerotas

    Joined:
    Sep 4, 2011
    Posts:
    5,572
    Hey guys....what the heck do I populate in the UserID in code like below? And how do I get it?
    ----------------------
    FacebookBinding.graphRequest("/" + UserID + "/scores", "POST", ht);
     
  15. prime31

    prime31

    Joined:
    Oct 9, 2008
    Posts:
    6,426
    @jerotas, first fetch the userID by calling the "me" Graph API call.
     
  16. jerotas

    jerotas

    Joined:
    Sep 4, 2011
    Posts:
    5,572
    Ok...it returns an object via "customRequest". I wanted to check how to get the userId out of there by logging it and reading the output in xCode, but I can't figure out where Debug.Log statements show up in xCode...I figured they'd show up in the Console window in the Organizer for the device. But none of my Debug statements are showing up there. And yes I have script debugging turned on. Where is that stuff hiding?
     
  17. prime31

    prime31

    Joined:
    Oct 9, 2008
    Posts:
    6,426
    @jerotas, logs in Xcode show up right in the main window. There is a window pane that takes up the bottom portion of Xcode with the console.
     
  18. jerotas

    jerotas

    Joined:
    Sep 4, 2011
    Posts:
    5,572
    Okay, I'm now in the same boat as Kev and some others on this thread. Trying to post a score to Facebook with graphRequest and it's telling me: Error 10000, access_token must be passed (which Prime31 says is passed automatically). Did anyone resolve this and how? Gawd, I'd been trying to get this to work for 4 evenings now. This is the most difficult plugin I've ever used haha. I'm confident we'll get it working but dayam!
     
  19. prime31

    prime31

    Joined:
    Oct 9, 2008
    Posts:
    6,426
    @jerotas, the access_token is added automatically but it is a user access token. If you check the previous posts and Facebooks documentation you will see that scores require an app access token. You need to manually pass in the app access token to the method to override the user access token.
     
  20. jerotas

    jerotas

    Joined:
    Sep 4, 2011
    Posts:
    5,572
    Where do I get the app access token and do I give it as the value of the "access_token" or something else? I recall reading that this doesn't work:

    Hash.Add("access_token", FacebookBinding.getFacebookAccessToken());

    I think I saw you say somewhere to use a WWW get to obtain it? Is there really no better way? If not, what object would I be using to do that?
     
  21. prime31

    prime31

    Joined:
    Oct 9, 2008
    Posts:
    6,426
    @jerotas, it is just a standard WWW call to get it. Check Facebooks docs for the endpoint and parameters.
     
  22. jerotas

    jerotas

    Joined:
    Sep 4, 2011
    Posts:
    5,572
    Not sure what that means...what C# object do I use for a "standard www call"? Anyone have some sample code for this?
     
  23. prime31

    prime31

    Joined:
    Oct 9, 2008
    Posts:
    6,426
    @jerotas, WWW is the class Unity uses to make web requests.
     
  24. J_P_

    J_P_

    Joined:
    Jan 9, 2010
    Posts:
    1,027
    Getting the app access token is easy. You can include it in the graph request and it'll still give the same error because, I believe, the plugin sends the user access token regardless. Correct me if I'm wrong, but you can't send a graph request without the user access token unless you modify the plugin.
     
    Last edited: Apr 5, 2012
  25. jerotas

    jerotas

    Joined:
    Sep 4, 2011
    Posts:
    5,572
    Ok I have now retrieved the App Access Token, which it says is something like "194277964017444|oNxXyo9b_OOJ6nlmpkivwVA85tE".. Notice the pipe (|) after the numbers and before the gibberish. Do I need this whole thing or just the part on the left or right of the pipe? Regardless, I passed this whole thing as the "access_token" and I still get the same error when trying to post the score:

    "Error 10000, access_token must be passed"

    Anyone know how to solve this? I'm at my wits end, this is day 5 of trying to get this to work.
     
    Last edited: Apr 6, 2012
  26. jerotas

    jerotas

    Joined:
    Sep 4, 2011
    Posts:
    5,572
    Was this update ever done? I don't want to modify a ".m" file as I don't know C at all and I'd need to do it on every deployment in xCode.
     
  27. akwok

    akwok

    Joined:
    Apr 21, 2009
    Posts:
    31
    What should I do if I want to ask for player's extended permission after initial authentication in Facebook?
    For example, I've asked users to give their read_stream permission and users have already granted it. Now I want to retrieve their publish_stream permission as well but I've not asked for it previously.
     
  28. J_P_

    J_P_

    Joined:
    Jan 9, 2010
    Posts:
    1,027
    If it doesn't automatically ask them to log in again, you can probably just trigger it manually.
     
  29. Deleted User

    Deleted User

    Guest

    Are Facebook URL scheme suffixes supported? I think I can just add the suffix to the Info.plist addition but it seems to me a variation of the FacebookBinding.init method would be required.
     
  30. prime31

    prime31

    Joined:
    Oct 9, 2008
    Posts:
    6,426
    @technicat, adding the suffix to the Info.plist is no problem but I am not sure what Facebook requires for login or if it is different.
     
  31. Deleted User

    Deleted User

    Guest

  32. jerotas

    jerotas

    Joined:
    Sep 4, 2011
    Posts:
    5,572
    Still hoping that one of you guys that got Facebook posting of a score to work will read this (my post on the previous page actually) and let me know what the heck I'm missing or what to check. E gads.
     
  33. iRetrograde

    iRetrograde

    Joined:
    Oct 13, 2011
    Posts:
    93
    Hi Prime, I got a question for you.

    My app is up and running fine. I can connect to facebook, make posts on my wall, and everything. However, it seems like when I send a request from the app to other users, that the information is not going through.

    Basically, I run the android application, log in, the request dialog comes up, I send out the requests, but inside of Facebook, I don't seem to be receiving those messages. Is this an issue with the plugin or an aspect of Facebook?

    P.S. Other things like graph requests seem to be working fine
     
  34. prime31

    prime31

    Joined:
    Oct 9, 2008
    Posts:
    6,426
    @Iretro, I've got a bug report open with Facebook about this now. One of our app IDs is showing the same results you are seeing but 3 or 4 others work fine.
     
  35. iRetrograde

    iRetrograde

    Joined:
    Oct 13, 2011
    Posts:
    93
    Can you give me a bit more info about what the issue seems to be?

    Should I be filing a bug report with Facebook about this in regards to my app ID? Have you received any info? Do you expect this to be something simple like they doing some reset for the app, or is this something more tech-related that might take a while to fix?

    Sorry if I'm buggin', but I just want to know whether this will be something that I'll be shipping with or cutting out for now...
     
    Last edited: Apr 9, 2012
  36. prime31

    prime31

    Joined:
    Oct 9, 2008
    Posts:
    6,426
    @iretro, all the info that I have is that apprequests do not show up as notifications with a specific app ID. If you are experiencing anything like that then absolutely open a bug report.
     
  37. bbvrdev

    bbvrdev

    Joined:
    Aug 11, 2009
    Posts:
    221
    Hey Prime, I'm trying to integrate the new version of the Social Networking plugin, but I can't seem to get it to log in. Each time, it loads up the FB ipad app, but the popup window within the app which would normally contain the authorization dialog merely shows my own wall.

    I have added the app ID to the demo project in the info.plist, and am calling init with the following:
    Code (csharp):
    1.  
    2. if( GUI.Button( new Rect( xPos, yPos, width, height ), "Initialize" ) )
    3. {
    4.     FacebookBinding.init( "fb123456789" ); //my code is in there
    5. }
    6.  
    Unfortunately I keep getting an empty string when I debug.log the access token.
    Any ideas? This was working before, and I just tried to sandbox the new version first before dropping it in my app.
     
    Last edited: Apr 9, 2012
  38. prime31

    prime31

    Joined:
    Oct 9, 2008
    Posts:
    6,426
    @sand, in the URL scheme it should be "fb" + YourAppId. In the init method it should be just YourAppId
     
  39. iRetrograde

    iRetrograde

    Joined:
    Oct 13, 2011
    Posts:
    93
    Prime,

    So just at random, because of your App ID, you seem to be getting this? I submitted a bug report to them just in case...

    So, do I have to make sure that my app page is up and running, or that my privacy policy be in place for all of this to work or should it just work from the box? I made sure to go into the app setup (inside FB) and make sure that the app wasn't in sandbox or anything but I'm not sure if this is unnecessary.

    Any other pointers just to make 100% it's not on my end of things?
     
  40. prime31

    prime31

    Joined:
    Oct 9, 2008
    Posts:
    6,426
    @iretro, as far as I know (and from my test apps) nothing special is required. My test apps Have nothing other than the required fields filled in and they work fine.
     
  41. bbvrdev

    bbvrdev

    Joined:
    Aug 11, 2009
    Posts:
    221
    Hey Prime, thanks for responding so quickly. I have been trying all afternoon to knock this one out to no avail. I have removed the "fb" from the init string, but still it returns null when printing the access token. Any ideas? I keep feeling as if I'm missing something, but I can't fathom what it is.
     
  42. prime31

    prime31

    Joined:
    Oct 9, 2008
    Posts:
    6,426
    @sand, if Facebook does not reopen your app automatically after login you will never have an access token. Read through the docs and ensure you have everything setup properly paying special attention to the URL scheme setup and your bundle ID setup on the Facebook web portal.
     
  43. bbvrdev

    bbvrdev

    Joined:
    Aug 11, 2009
    Posts:
    221
    When setting up my app with FB, am I not supposed to select "Native IOS App" for how my app communicates with FB, and in there add the bundle ID? Since I do not currently have an iPhone App Store ID (game isn't yet published, of course), the field won't save, citing that iTunes is reporting that the game isn't available in the US store.

    Any ideas? This seems to be the only place to set up the bundle ID in the FB web portal. Oddly enough, as I mentioned, this used to be working. I wonder if my settings got dumped on FB's end...
     
  44. prime31

    prime31

    Joined:
    Oct 9, 2008
    Posts:
    6,426
    @sand, you are making a native iOS app do you absolutely should set it as such. You. An stick the iTunes ID of any app in the App Store in there while testing.
     
  45. jerotas

    jerotas

    Joined:
    Sep 4, 2011
    Posts:
    5,572
    I upgraded to the new version of this today. Unfortunately it doesn't seem that the getAppAccessToken method works. I keep getting empty string returned. Whereas my old WWW method worked. Anyone else got this to work?
     
  46. iRetrograde

    iRetrograde

    Joined:
    Oct 13, 2011
    Posts:
    93
    Hey Prime thanks a lot for your help. I hope they come around with some info soon.
     
  47. bbvrdev

    bbvrdev

    Joined:
    Aug 11, 2009
    Posts:
    221
    Jerotas, I'm in the same boat. I can't seem to get it working either, I have tried everything I can think of!
    Plus it appears my FB page broke at the same time! What is going on??
     
  48. prime31

    prime31

    Joined:
    Oct 9, 2008
    Posts:
    6,426
    @jerotas and @sand, we have tested across all iOS devices without issue. You do understand that the method is asynchronous and returns void, right? You have to pass it a completion handler which will provide the app access token or null if there is an issue.
     
  49. jerotas

    jerotas

    Joined:
    Sep 4, 2011
    Posts:
    5,572
    Yes I used the lambda operator ( => ) - same as the included test scene 2. It does not work over here. Going back to my WWW code to see if that works on the new version. I am calling FacebookBinding.Init in my Awake method and trying to grab the AppAccessToken in the Start method. Which worked in the previous version with WWW code.
     
  50. bbvrdev

    bbvrdev

    Joined:
    Aug 11, 2009
    Posts:
    221
    I am literally using the test scene with no modifications, other than to input my FB id. Still no love.
    Perhaps I should revert to the old version, since I'm in QA right now and under a tight deadline.