Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice
  3. Join us on November 16th, 2023, between 1 pm and 9 pm CET for Ask the Experts Online on Discord and on Unity Discussions.
    Dismiss Notice

[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
    @autowash, read the returned error details. Twitter doesnt usually fail with no reason (unless the service is down).
     
  2. autowash

    autowash

    Joined:
    Oct 14, 2012
    Posts:
    18
    What returned error details are you referring to? Please note that the postFailedEvent does NOT fire, so no error message to be read there. The postSucceededEvent DOES fire.

    The post seems to succeed, as no error is generated, but it fails to materialize in my twitter feed. I have checked the app-specific settings in my twitter account, and it says my app has permission to post. Everything seems ok...
     
  3. prime31

    prime31

    Joined:
    Oct 9, 2008
    Posts:
    6,426
    @auto, postFailed means that a full stop error occurred (4xx status code, server failure, etc). The post can still succeed but the operation you were trying to perform can fail.
     
  4. akmcdaniel

    akmcdaniel

    Joined:
    Mar 18, 2013
    Posts:
    1
    Hello prime,

    I'm attempting to implement a gifting system using apprequests. I've gotten to the point where I can receive and parse incoming requests, but now I need to be able to delete them. The Graph API documentation says to use the HTTP verb "DELETE", but this doesn't seem to be available to me in the plugin. Let me know if I'm missing something. Thanks.
     
  5. prime31

    prime31

    Joined:
    Oct 9, 2008
    Posts:
    6,426
    @akmcdaniel, the graphRequest method on the FacebookBinding class most certainly lets you set the verb.
     
  6. Nub3h

    Nub3h

    Joined:
    Aug 23, 2012
    Posts:
    56
    Hi Prime31,
    I'm having a problem with posting scores on Facebook. I use the following code

    Facebook.instance.postScore(FBid, *MY SCORE INT*, playerScorePostedOnFacebook);

    and this was working last week (I was posting successfully). For some reason I noticed it doesn't anymore and I can't figure out why. I tried to update the plugin but no success, the method playerScorePostedOnFacebook is called with a bool false. I tried to debug the access token I get after login on Facebook (which works when I launch the app) and it's valid and the permissions are granted. It's just the post score that fails for some reason.

    Any idea how I can debug this?

    NOTE: in the Facebook APP page I'm not using the real App Id because the app is in development so no ID yet. Not sure if this might be the issue but as I said, everything was working last week.
     
  7. Gokhan Dogramaci

    Gokhan Dogramaci

    Joined:
    Oct 22, 2012
    Posts:
    6
    Hi Prime31,
    I have two problems with social networking plugin on iOS;

    1) I open the twitter-login page on ipad, then when I close it, somehow the screen resolution is decreasing and my game is just covering the half of the screen. I've tested this situation on android devices and none of them made this. Is it possible to open twitter-login page in popup (like Facebook) or give it a custom size?

    2) I'm using the same parameters with android but when I try to post something to facebook with FacebookBinding.showDialog("stream.publish", parameters) on iOS, the Facebook popup opens and gives me an error message like: "An error has occurred, try again later.". I'm using this code for both iOS and android. It works on Android perfectly but iOS gives me always an error.

    I'd appreciate if you can help. Thanks in advance...
     
  8. uhhhhhhh

    uhhhhhhh

    Joined:
    Aug 3, 2012
    Posts:
    7
    Prime31,

    I realize you are not responsible for the Graph API; however, I am having an issue with the completion handler on Android.

    Through logcat I can verify that I'm collecting the proper information (primarily for the use of viewing friends of a given user). The issue comes with accessing the information myself to store within the application. I seem to be unable to have any control over the "object result" that's returned.

    If you could point me in the right direction to tap into the information returned from the Graph API I would greatly appreciate it.

    Thanks!
     
  9. mytoltoly

    mytoltoly

    Joined:
    Apr 23, 2009
    Posts:
    41
    I go same screen size issue when I open and close Twitter login screen.
     
  10. prime31

    prime31

    Joined:
    Oct 9, 2008
    Posts:
    6,426
    @gokhan, 1. we cannot reproduce. Read and understand the General section of our docs to learn about native views: http://prime31.com/docs#iosGeneral 2. contact Facebook. We cannot answer questions about errors occurring on Facebook's servers.


    @uhh, Facebook's documentation will tell you exactly what each Graph API request returns
     
  11. MaulikKaloliya

    MaulikKaloliya

    Joined:
    Sep 28, 2012
    Posts:
    12
    Hi
    Prime31

    there is a problem in facebook postScore

    in Facebook.cs

    public void postScore( string userId, int score, Action<bool> completionHandler )
    {
    if( appAccessToken == null )
    {
    Debug.Log( "you must first retrieve the app access token before posting a score" );
    completionHandler( false );
    return;
    }

    if( userId == null )
    {
    Debug.Log( "a valid userId is required to post a score" );
    completionHandler( false );
    return;
    }

    // post the score to the proper path
    var path = userId + "/scores";
    var parameters = new Dictionary<string,object>()
    {
    { "score", score.ToString() },
    { "app_access_token", appAccessToken },
    { "access_token", appAccessToken }
    };

    post( path, parameters, ( error, obj ) =>
    {
    //When i debug
    Debug.Log("Mak => " + obj + " is bool => " + (obj is bool) + " error => "+ error + ";");

    if( error == null obj is bool )
    {
    var result = (bool)obj;
    completionHandler( result );
    }
    else
    {
    completionHandler( false );
    }
    });
    }

    when i debug
    Debug.Log("Mak => " + obj + " is bool => " + (obj is bool) + " error => "+ error + ";");
    i got following
    Mak => true is bool => False error => ;
    $Untitled.png
    so (obj is bool) is always false but response text : true at the time posting the score and score is posted on facebook
    but completionHandler() will return false so i can't take decision from completionHandler that score is posted or not though it is posted
     
    Last edited: Mar 25, 2013
  12. Nub3h

    Nub3h

    Joined:
    Aug 23, 2012
    Posts:
    56
    Yes I have the same problem with the scores not posting...
    also why the lines:

    { "app_access_token", appAccessToken },
    { "access_token", appAccessToken }

    both pass the appAccessToken?

    @MaulikKaloliya: did you just comment out " obj is bool" to solve the problem?
     
  13. Nub3h

    Nub3h

    Joined:
    Aug 23, 2012
    Posts:
    56
    ok I fixed the post score problem by adding

    bool result = false;
    bool.TryParse(success.ToString(), out result);

    to the success object returned by Facebook after posting a score. For some reason what was returned if printed was "true" but it was NOT a boolean as it should be. Hope this might help.
     
  14. ArseneySorokin

    ArseneySorokin

    Joined:
    Jan 23, 2013
    Posts:
    63
    Hi PRIME31,

    I'm getting 9 errors from this plug-in.
    8 of them are: 'FacebookManager' does not contain a definition for .... and then it lists 8 different events.
    The 9th error is "No overload for method 'init' takes 1 argument.

    My build settings are set to iOS and it seems like FBManager DOES define these events so I can't seem to find what's wrong.
     
  15. binttackx

    binttackx

    Joined:
    Nov 23, 2012
    Posts:
    2
    hi prime31,

    I have error when login to twitter using this function :

    TwitterBinding.showOauthLoginDialog();

    here the error log from xcode :

    2013-04-05 16:28:55.993 (rep[9645:907] got reqeust token
    2013-04-05 16:28:55.996 fahombo[9645:907] https://twitter.com/oauth/authorize?oauth_token=yNsUsOh3lMuXIfBpw5TgRakvY01VXft224VzND6h0
    2013-04-05 16:28:58.194 fahombo[9645:907] https://twitter.com/oauth/authorize
    2013-04-05 16:28:58.710 fahombo[9645:907] http://google.com/?oauth_token=yNsU...r=etmbdRhOrWHB5tIP1o3qHIX8ucmltqbwABDnDfvZZ5o
    2013-04-05 16:28:58.713 fahombo[9645:907] got verifier after successful login
    Twitter login failed: <?xml version="1.0" encoding="UTF-8"?>
    <hash>
    <request>/oauth/access_token</request>
    <error>Invalid / expired Token</error>
    </hash>
    &oauth_verifier=etmbdRhOrWHB5tIP1o3qHIX8ucmltqbwABDnDfvZZ5o

    this error also happen in TwitterTestScene.unity (in demo ios folder).

    I'd appreciate if you can help. Thanks in advance...
     
  16. Abza1989

    Abza1989

    Joined:
    Jul 17, 2012
    Posts:
    47
    @prime i posted in the wrong forum because it belongs here.

    I had all my twitter and Facebook connected up for a month and today i started getting this in the Console.

    2013-04-05 11:14:15.436 ZombieDeathRace[889:707] got reqeust token
    2013-04-05 11:14:15.653 ZombieDeathRace[889:707] https://twitter.com/oauth/authorize?...I51Y88Z0WImvRY
    2013-04-05 11:14:26.863 ZombieDeathRace[889:707] Opening '/var/mobile/Library/Caches/com.apple.keyboards/images/4272984597' failed: 'No such file or directory' (2)
    2013-04-05 11:14:27.037 ZombieDeathRace[889:707] 'INSERT INTO store VALUES (?,?,?,?,?,?,?,?)' constraint failed (19)
    2013-04-05 11:14:38.863 ZombieDeathRace[889:707] https://twitter.com/oauth/authorize
    2013-04-05 11:14:41.527 ZombieDeathRace[889:707] http://www.syncinteractive.co.uk/?oa...XjJM0VzT2KO7Dg
    2013-04-05 11:14:41.529 ZombieDeathRace[889:707] got verifier after successful login
    Twitter login failed: <?xml version="1.0" encoding="UTF-8"?>
    <hash>
    <request>/oauth/access_token</request>
    <error>Required oauth_verifier parameter not provided</error>
    </hash>

    Has something changed?

    Thanks in advance.
     
  17. prime31

    prime31

    Joined:
    Oct 9, 2008
    Posts:
    6,426
    @abza / @binttack, fetch the latest update which has some new stuff added to address the changes Twitter has made.
     
  18. pluhn

    pluhn

    Joined:
    Jul 27, 2010
    Posts:
    42
    I had an issue pop up today where the Twitter login screen apparently unlocks my set device orientation. My app is locked to landscape right or left, but after logging into Twitter it returns to the app with the screen having shrunk. Rotating the device fixes it, but now portrait orientation is possible, which I do not want. Is this a Twitter thing or a Prime31 thing? It occurs on both an iPad 2 and 3, but not on an iPhone 4.




     
  19. binttackx

    binttackx

    Joined:
    Nov 23, 2012
    Posts:
    2
    Hi Prime31,
    thanks for the answer.
    but, I've already fetch the latest update, and still have same error.
    I also use social network plugin for android, but it's working fine.
    is the problem came from my twitter app?

    Thanks in advance.
     
  20. KS_Vince

    KS_Vince

    Joined:
    Feb 28, 2013
    Posts:
    5
    I want to make something very simple : use the composer.
    It works if I'm logged into facebook in my iPad settings.
    If I remove my facebook account from the settings, nothing happens when I call showFacebookComposer.
    I thought that it was not needed to manage the facebook login inside the app and that calling the composer would popup a login window, am I wrong ?

    Edit : I must be, because FacebookBinding.canUserUseFacebookComposer() returns false if I logout from iPad settings. What should I do then to get the user logged in the settings if he's not ?
    Apparently login in with FacebookBinding.login() is not enough.
     
    Last edited: Apr 10, 2013
  21. prime31

    prime31

    Joined:
    Oct 9, 2008
    Posts:
    6,426
    @LS, if the user is not already logged into Facebook via iOS directly showing the composer does nothing.
     
  22. KS_Vince

    KS_Vince

    Joined:
    Feb 28, 2013
    Posts:
    5
    Thanks for your answer.
     
  23. prime31

    prime31

    Joined:
    Oct 9, 2008
    Posts:
    6,426
    @KS, you cannot use the Facebook composer unless the user is logged in via iOS Settings.app. There is not way around this fact.
     
  24. KS_Vince

    KS_Vince

    Joined:
    Feb 28, 2013
    Posts:
    5
    That's what I thought, I'll probably just ask the user to do it then.
     
  25. andymads

    andymads

    Joined:
    Jun 16, 2011
    Posts:
    1,614
    @pluhn, I've just seen the 'shrinking screen after twitter auth' issue too!
     
  26. AR_font

    AR_font

    Joined:
    Apr 11, 2013
    Posts:
    2
    @andymads
    @pluhn
    I'm having the same exact issue when running my project on my iPad. I updated the plugin today, to the 04-11-2013 release (great plugin by the way!), and I'm getting the shrinking screen issue since importing it in my project.

    I did what the documentation says: "Important Note: whenever using any plugin that shows native views of any kind you must set your Unity player settings to autorotate animated and you cannot ever set the orientation via code", but the problem persists.
    I had absolutely no problem with this issue with past versions of the plugin , even when I didn't configure my app for animated autorotate (my game isn't even supposed to rotate)

    Another thing I noticed (which may be related) is that the Twitter authentication screen now takes up the whole iPad screen, whereas it was smaller before I updated the plugin.

    Any word on what may be causing this or how to fix the issue?
     
  27. prime31

    prime31

    Joined:
    Oct 9, 2008
    Posts:
    6,426
    @AR, the Unity view is handled entirely by Unity. It sounds like you came across an autorotation issue. You will want to submit a bug report via the Unity bug reporter.
     
  28. RichardWalker

    RichardWalker

    Joined:
    Jan 10, 2013
    Posts:
    1
    @AR_font
    @prime31

    If you're using the current 04-11-2013 release, in TwitterManager.mm, - (void)showViewControllerModallyInWrapper:(UIViewController*)viewController, line 119, change vc.modalPresentationStyle = UIModalPresentationFormSheet; to be viewController.modalPresentationStyle = UIModalPresentationFormSheet;

    That fixed all my scaling and rotation issues after Twitter authentication.
     
  29. AR_font

    AR_font

    Joined:
    Apr 11, 2013
    Posts:
    2
    Thanks! That indeed solved my problem.
     
  30. J3-Gaming

    J3-Gaming

    Joined:
    Dec 23, 2010
    Posts:
    55
    Not sure what your preferred bug contact method is mike, posted on your support area:
    http://prime31.com/support/760/twitter-could-not-authenticate-with-oauth

    --
    Separate issue:
    --

    Also, I get the shrinking screen bug too.
    It can be reproduced by using an ipad3, calling login to twitter and click any button that will return you to the app. The screen is sized to what i assume to be 768x1024 centred, when it should of course be doubled for the ipad 3rd gen (and i assume 4th gen has the bug too)

    In my app, I HAVE to have portrait landscape on, i understand you want people to put auto rotation on, but that won't be possible in my case. (In my case though, i do not do any orientation changes, i let unity lock it into portrait)
     
    Last edited: Apr 12, 2013
  31. pluhn

    pluhn

    Joined:
    Jul 27, 2010
    Posts:
    42
    The latest Prime31 update that was available this morning fixed the Twitter shrinkage/rotation issue for me.
     
  32. SpinFall.com

    SpinFall.com

    Joined:
    Apr 16, 2013
    Posts:
    10
    Getting the expired token error:

    Looks like this post on twitter dev forums points to an update in access policies:
    https://pes-spartans.appspot.com/dev.twitter.com/discussions/16443

    Can someone with more knowledge on this verify that it is related to the the above error?
     
  33. prime31

    prime31

    Joined:
    Oct 9, 2008
    Posts:
    6,426
    @spin, here is a link to our release notes page: http://prime31.com/releaseNotes I suggest that you bookmark it or subscribe to the RSS feed. We pushed out an update when Twitter's policy was changed to address their auth changes.
     
  34. SpinFall.com

    SpinFall.com

    Joined:
    Apr 16, 2013
    Posts:
    10
    @prime31

    I updated through the unity asset store earlier today and this did not fix the problem. Is the asset store version the latest? Is there something specific I need to update in my code to fix this?

    Thanks
     
  35. prime31

    prime31

    Joined:
    Oct 9, 2008
    Posts:
    6,426
    @spin, the Asset Store is always a bit behind due to the review process. It should be available there soon.
     
  36. SpinFall.com

    SpinFall.com

    Joined:
    Apr 16, 2013
    Posts:
    10
    @prime31
    I definitely understand that. Is there a way I can access the updated plugin today - outside of the asset store?
     
  37. prime31

    prime31

    Joined:
    Oct 9, 2008
    Posts:
    6,426
    @spin, no there isn't. Folks who purchase from us directly get updates more often and faster. It is a perk for those who supported us in the days before the Asset Store existed.
     
  38. SpinFall.com

    SpinFall.com

    Joined:
    Apr 16, 2013
    Posts:
    10
    Ok, I have purchased plug-ins from you directly but I suppose it is on a plugin by plugin basis. I'll wait it out then, hopefully the review is fast.
     
  39. SpinFall.com

    SpinFall.com

    Joined:
    Apr 16, 2013
    Posts:
    10
    @prime31 Looks like there was an update while this thread was going on. I've since updated and the problem appears to have been fixed [still testing to be sure].
     
  40. josafa

    josafa

    Joined:
    Jan 30, 2013
    Posts:
    2
    @prime31 is it possible to add a facebook like button using this plugin? I want to reward players that like my game page on facebook. I've searched about that but can't found an answer.

    I'm sorry if you already replied that in this thread, but it's too long, i can't read all the messages.
     
  41. prime31

    prime31

    Joined:
    Oct 9, 2008
    Posts:
    6,426
    @josafa, visit Facebooks Graph API documentation to learn all of the hundreds of endpoints that are available. We obviously are not and cannot be familiar with all of what Facebook makes available.
     
  42. Peter Hou

    Peter Hou

    Joined:
    Oct 12, 2010
    Posts:
    66
    This is understandable. I would however consider a "Like"-button to be quite common functionality and seeing how many users are struggling with it, I think it would be greatly appreciated if the Social Networking Plugin included an example.

    I hope that whoever ends up figuring out how to create a proper "Like"-button decides to share his/her findings with the community :)
     
  43. PAHeartBeat

    PAHeartBeat

    Joined:
    Jul 11, 2012
    Posts:
    76
    Hi Friends and Prime[31].
    When I update with new SoicalNetworking plugin for iOS, i found if user not loged in native facebook application of iOS 6.x.x, and we tried to login in facebook. it's crash / stuck in xCode with error (unfortunately i can't attach screenshot of error)

    Code (csharp):
    1. 33db71be:    str    r3,    [sp, #48]                 Thread 1: EXC_BAD_ACCESS (code=2, address=0x2fd00f58 )
    when user already loged in native facebook application of iOS 6.x.x it's works fine without any error.
    Edit:
    Plugin also not works bellow iOS 6.0, when we use old iOS version like 4.x or 5.x it's not show login page / window using any of these methods after facebook initialise usingFacebookBinding.init (); method. I will wait 20 - 30 second for facebook login methos, but still I not find any success

    Method 1
    Code (csharp):
    1. var permissions = new string[] { "email" };
    2. FacebookBinding.loginWithReadPermissions( permissions );
    3.  

    Method 2

    Code (csharp):
    1. FacebookBinding.login ();
    SocialNetworking_2013-04-18 is officially support for old iOS version like iOS 4.x and iOS 5.x?



    ***Edited on* 22nd Apr 2013**
    I found something which may Prime31 Missed to add in their new plug-in in SocialNetworking_2013-04-18, I just watching a video from Prime31 Documentation for iOS on this link [http://www.youtube.com/watch?v=3-id13v0_L4][1] it's show `facebookBinding.init();` Method which have string parameter of Facebook AppID, but method `facebookBinding.init();` with AppID Parameter is not available in plugin may it's cause the issue for login window.


    Prime[31] Please update plugin ASAP, so we can continue with our development cycle. Again unfortunately I am not able to upload snapshot of the code and video.




    [1]: http://www.youtube.com/watch?v=3-id13v0_L4
     
    Last edited: Apr 22, 2013
  44. rejwan1

    rejwan1

    Joined:
    Jul 3, 2012
    Posts:
    40
    Hello Prime31,
    The social plugin worked perfectly well for our project, recently it stopped logging into Facebook.

    I've downloaded the newest version from your website and created a completely new project and loaded the social plugin into it and set up our FB app ID, URL scheme and name.

    I've ran the test scene and clicking Login does absolutely nothing.
    If I click it again I'll get the following error:
    Any ideas? Thanks.
     
  45. prime31

    prime31

    Joined:
    Oct 9, 2008
    Posts:
    6,426
    @rejwan, Facebook is returning an unknow error. Unfortunately that doesn't provide much information. I would suggest double and triple checking your setup including the new requirement of your app display name matching exactly what appears in the Facebook web portal.
     
  46. rejwan1

    rejwan1

    Joined:
    Jul 3, 2012
    Posts:
    40
    Hey Prime31,
    Thanks for the quick reply - The error is returned only if I click login twice.
    The first time just wouldn't do anything, visually or console wise.

    I've quadruple checked that my app display name, app ID and URL scheme are correct - still, nothing.

    I've called init (nothing shows in log) - and when I try to get the access token it's empty as well.
     
  47. PAHeartBeat

    PAHeartBeat

    Joined:
    Jul 11, 2012
    Posts:
    76
    ***Edited on* 22nd Apr 2013**
    I found something which may Prime31 Missed to add in their new plug-in in SocialNetworking_2013-04-18, I just watching a video from Prime31 Documentation for iOS on this link [http://www.youtube.com/watch?v=3-id13v0_L4][1] it's show `facebookBinding.init();` Method which have string parameter of Facebook AppID, but method `facebookBinding.init();` with AppID Parameter is not available in plugin may it's cause the issue for login window.


    Prime[31] Please update plugin ASAP, so we can continue with our development cycle. I just upload snapshot of the miss match.



    [1]: http://www.youtube.com/watch?v=3-id13v0_L4
    $Screen Shot 2013-04-22 at 5.05.02 PM.png $Screen Shot 2013-04-22 at 5.25.21 PM.png
     
  48. prime31

    prime31

    Joined:
    Oct 9, 2008
    Posts:
    6,426
    @PA, Facebooks SDK hasn't required the appId in init for several versions now.
     
  49. damelin2

    damelin2

    Joined:
    Jan 8, 2013
    Posts:
    19
    Hi Prime,

    I've updated the Social Networking plugin to use the FB SDK 3.5. There's an infinite loop upon logging-in when the facebook app is in Sandbox mode.

    I've setup the url scheme, app id and display name in the info.plist (additions.) Using your FacebookTestScene. I hit the "Initialize Facebook", "Login", then XCode crash since it has detected an infinite loop. See the attachment picture for the call stack info.

    Do you think that something could be done in the plugin to avoid that?

    Thanks

    Edit: As you see in the call stack, the login has to use safari to reproduce the issue.

    $Screen Shot 2013-04-22 at 1.16.17 PM.png
     
    Last edited: Apr 22, 2013
  50. prime31

    prime31

    Joined:
    Oct 9, 2008
    Posts:
    6,426
    @damlien, if you check our docs page you will see how to get the previous version of the icon. The Facebook SDK 3.5 appears to have a few bugs.