Search Unity

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

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

  1. nada

    nada

    Joined:
    Sep 30, 2010
    Posts:
    20
    hi prime
    i'm trying to login to twitter usign 'showOauthLoginDialog'. it keeps hanging on the page, where twitter is showing me the pin and tells me to go back.

    in xcode debug view, the last messages i get are
    Code (csharp):
    1. 2011-11-22 16:53:09.130 appname[1849:307] got reqeust token
    2. [Switching to process 12803 thread 0x0]
    3. [Switching to process 14851 thread 0x0]
    4. [Switching to process 11523 thread 0x0]
    i tracked this down to P31Request.m's connectionDidFinishLoading method but am not able to fix a possible issue here. tried it with 3gs and 4 gen devices.

    any hints would be great! tnx in advance.
    nada
     
  2. Jason-H

    Jason-H

    Joined:
    Nov 5, 2010
    Posts:
    87
    Ok I've fixed it now it seems...

    I just called "ShowPostMessageDialogWithOptions" twice within the "LoadFB" function.

    Hope that helps anyone else with the same issue!
     
  3. prime31

    prime31

    Joined:
    Oct 9, 2008
    Posts:
    6,426
    @nada, you didnt setup your Twitter app as a Browser app in the Twitter dev portal. Refer to the docs for the details.
     
  4. Kevpearman

    Kevpearman

    Joined:
    Dec 9, 2009
    Posts:
    44
    Prime,
    I'm using your social plugin to post to a users wall and i think i've managed to iron out the wrinkles in my workflow for ensuring the user is logged in etc however i also want to incorporate leaderboards based off of facebook friends lists into my game.

    Now there's a couple of ways i could accomplish this and i was just after some advice really. If i post the scores to my own database via a form post along with user information then i can store all the information i need and retrieve it as neccesary but how do i get the current user's facebook ID? I'm sorry if this is really obvious but i've been so wrapped up in all this for weeks and i cant see the wood for the trees at the minute.

    The second, easier option, would be to use facebook to store the leaderboards. I don't know much about the facebook SDK which is why i bought your plugin, to save me going too in depth. I've read conflicting posts about whether or not facebook support leaderboards via their API. If they do, can someone point me in the direction of a good web post about how to set it up?

    I want to get this last bit sorted so i can update my app in the store and get working on gamecentre integration. Yes i know their are leaderboards on gamecentre but i'm kinda hoping that facebook leaderboards could be more of a selling point than the gamecentre ones :)

    Thanks for a well made and supported plugin at a reasonable price, helps us lone developers have a chance keeping up with everyone else.

    Cheers


    Kev
     
  5. prime31

    prime31

    Joined:
    Oct 9, 2008
    Posts:
    6,426
    @kev, you can get the users Facebook ID with the "me" graph request. See the demo scene for an example of how to make a Graph API request. For your other questions you may want to check Facebooks documentation to see what they offer.
     
  6. ptdnet

    ptdnet

    Joined:
    Apr 20, 2011
    Posts:
    100
  7. ptdnet

    ptdnet

    Joined:
    Apr 20, 2011
    Posts:
    100
    And it appears (from what I've read) that the Graph API does not allow sending a "LIKE" to your Facebook app. You have to have their HTML-style button someplace and use that. Lame!
     
  8. nada

    nada

    Joined:
    Sep 30, 2010
    Posts:
    20
    prime, yeah i saw that before, did not get, that setting the callback makes the app a browser app.
    sorry having stolen your time, now it works...
     
  9. Kevpearman

    Kevpearman

    Joined:
    Dec 9, 2009
    Posts:
    44
    Prime31 - i'll take a lookat that.

    ptdnet - i've gone through so many of their pages i can't believe i missed that! Thanks for the pointer, that should save me quite a few headaches!
     
  10. OlaAtKongotec

    OlaAtKongotec

    Joined:
    Nov 25, 2011
    Posts:
    19
    Posting to Twitter: Strange behavior? Or am I doing this wong?

    Setup: unity3d 3.4.2 pro 30 day trial installed, xcode 4.2, iOs 5.0.1, twitter application xAuth approved

    In my scene: camera, EtceteraManager prefab and the SocialNetworkingManager prefab from plugin directory (created in the Etcetera SocialNetworking install), a gameobject with one button instantiating a "twitter" prefab with the script below added, and one log out button running "TwitterBinding.logout();". The "twitter" prefab and the script attached is not in the plug in directory.

    Problem description:
    Running the app, pressing the instantiate button, the "twitter" prefab instantiates and everything works fine, logs in to twitter etc, until TwitterPostFailed function throws:
    Twitter post failed: Could not authenticate you.

    Pressing the button again instantiates a new "twitter" game object. TwitterBinding.isLoggedIn(); returns true and then the script throws the same error.

    If I close the iOS application and re-open it, then pressing the button instantiating the "twitter" prefab again, TwitterBinding.isLoggedIn(); returns true and everything works... The message appears on twitter. Repressing it again also tweets.

    If i press the log out button, and then instantiate again: logging in, the error "Twitter post failed: Could not authenticate you." re-appears.

    May i add i've never coded c# before this script, so if the solution to my problem is obvious; please point me in the right direction. Also feel free to give me feedback on other improvements in the script.

    Code (csharp):
    1.  
    2.  
    3. using UnityEngine;
    4. using System.Collections;
    5.  
    6. public class ShareStringOnTwitter : MonoBehaviour {
    7.    
    8.  
    9.     public string consumerKey;
    10.     public string consumerSecret;
    11.    
    12.     public string OverwriteUserNameForQuickerDev;
    13.     public string OverwritePasswordForQuickerDev;
    14.    
    15.     public string TwoFieldPromptHeader = "Enter your Twitter credentials";
    16.     public string TwoFieldPromptMessageStart = "Ok Button Tweets: ";
    17.    
    18.     public string AlertBoxIfLoggedInHeader = "Share Your Progress?";
    19.     public string AlertBoxIfLoggedInMessageStart = "Tweet: ";
    20.     public string AlertBoxIfLoggedInOkButtonString = "Send Tweet";
    21.     public string AlertBoxIfLoggedInCancelButtonString = "Cancel";
    22.    
    23.     public string TheTweet = "Hello World Tweet";
    24.     public bool AddTimeStampToMessage = false;
    25.    
    26.     public Transform GameObjectToInstantiateOnSuccess;
    27.     public Transform GameObjectToInstantiateOnFail;
    28.     public Transform GameObjectToInstanitateOnCancel;
    29.    
    30.     public bool LogOutOnSuccess = false;
    31.     public bool LogOutOnFail = false;
    32.    
    33.     public bool SelfDestructOnFinish = false;
    34.    
    35.  
    36.    
    37.    
    38.     void Start()
    39.     {
    40.  
    41.         TwitterBinding.init( consumerKey, consumerSecret );
    42.  
    43.        
    44.         Debug.Log("start");
    45.  
    46.         bool IsLoggedInOnTwitter = TwitterBinding.isLoggedIn();
    47.        
    48.         if(AddTimeStampToMessage) TheTweet += " - " + Time.deltaTime ;
    49.        
    50.  
    51.        
    52.         if(IsLoggedInOnTwitter){
    53.            
    54.             EtceteraManager.alertButtonClicked += alertButtonClicked;
    55.            
    56.             EtceteraBinding.showAlertWithTitleMessageAndButtons( AlertBoxIfLoggedInHeader, AlertBoxIfLoggedInMessageStart + TheTweet, AlertBoxIfLoggedInOkButtonString, AlertBoxIfLoggedInCancelButtonString );
    57.            
    58.         } else {
    59.  
    60.             EtceteraManager.promptCancelled += promptCancelled;
    61.             EtceteraManager.twoFieldPromptTextEntered += twoFieldPromptTextEntered;
    62.  
    63.             EtceteraBinding.showPromptWithTwoFields( TwoFieldPromptHeader, TwoFieldPromptMessageStart + TheTweet, "username", "password", false );
    64.            
    65.         }
    66.  
    67.     }
    68.  
    69.     void alertButtonClicked ( string TheButtonClicked )
    70.     {
    71.         Debug.Log("alertButtonClicked");
    72.        
    73.         EtceteraManager.alertButtonClicked -= alertButtonClicked;
    74.         if(AlertBoxIfLoggedInOkButtonString == TheButtonClicked){
    75.             SendTwitterMessage();
    76.         } else {
    77.             AlertCancelled();
    78.         }
    79.     }
    80.    
    81.     void AlertCancelled()
    82.     {
    83.        
    84.         Debug.Log("AlertCancelled");
    85.        
    86.         InstanitateOnCancel();
    87.         Finish();
    88.     }
    89.  
    90.     void promptCancelled()
    91.     {
    92.         Debug.Log("promptCancelled");
    93.  
    94.         EtceteraManager.promptCancelled -= promptCancelled;
    95.         EtceteraManager.twoFieldPromptTextEntered -= twoFieldPromptTextEntered;
    96.         InstanitateOnCancel();
    97.         Finish();
    98.     }
    99.  
    100.     void twoFieldPromptTextEntered( string UserName, string Password )
    101.     {
    102.  
    103.         if( OverwriteUserNameForQuickerDev != "" ) UserName = OverwriteUserNameForQuickerDev;
    104.         if( OverwritePasswordForQuickerDev != "" ) Password = OverwritePasswordForQuickerDev;
    105.        
    106.        
    107.         Debug.Log("twoFieldPromptTextEntered - " + UserName + ", " + Password);
    108.        
    109.         EtceteraManager.promptCancelled -= promptCancelled;
    110.         EtceteraManager.twoFieldPromptTextEntered -= twoFieldPromptTextEntered;
    111.  
    112.         SocialNetworkingManager.twitterLogin += TwitterLoginSuccess;
    113.         SocialNetworkingManager.twitterLoginFailed += TwitterLoginFailed;      
    114.  
    115.         TwitterBinding.login( UserName, Password );
    116.        
    117.     }
    118.    
    119.     void TwitterLoginFailed ( string error )
    120.     {
    121.        
    122.         Debug.Log("TwitterLoginFailed - " + error);
    123.        
    124.         SocialNetworkingManager.twitterLogin -= TwitterLoginSuccess;
    125.         SocialNetworkingManager.twitterLoginFailed -= TwitterLoginFailed;
    126.         InstantiateOnFail();
    127.         Finish();
    128.     }
    129.  
    130.     void TwitterLoginSuccess ()
    131.     {
    132.         Debug.Log("TwitterLoginSuccess");
    133.  
    134.         SocialNetworkingManager.twitterLogin -= TwitterLoginSuccess;
    135.         SocialNetworkingManager.twitterLoginFailed -= TwitterLoginFailed;
    136.         SendTwitterMessage();
    137.     }
    138.    
    139.  
    140.    
    141.     void SendTwitterMessage ()
    142.     {
    143.         Debug.Log("SendTwitterMessage");
    144.  
    145.         SocialNetworkingManager.twitterPost += TwitterPostSuccess;
    146.         SocialNetworkingManager.twitterPostFailed += TwitterPostFailed;
    147.  
    148.         TwitterBinding.postStatusUpdate( TheTweet );
    149.     }
    150.    
    151.     void TwitterPostFailed ( string error )
    152.     {
    153.        
    154.         Debug.Log("TwitterPostFailed - " + error);
    155.        
    156.         SocialNetworkingManager.twitterPost -= TwitterPostSuccess;
    157.         SocialNetworkingManager.twitterPostFailed -= TwitterPostFailed;
    158.         if(LogOutOnFail) TwitterBinding.logout();
    159.         InstantiateOnFail();
    160.         Finish();
    161.     }
    162.    
    163.     void TwitterPostSuccess ()
    164.     {
    165.        
    166.         Debug.Log("TwitterPostSuccess");
    167.        
    168.         SocialNetworkingManager.twitterPost -= TwitterPostSuccess;
    169.         SocialNetworkingManager.twitterPostFailed -= TwitterPostFailed;
    170.         if(LogOutOnSuccess) TwitterBinding.logout();
    171.         InstantiateOnSuccess();
    172.         Finish();
    173.     }
    174.    
    175.     void InstanitateOnCancel ()
    176.     {
    177.        
    178.         Debug.Log("InstanitateOnCancel");
    179.        
    180.         if(GameObjectToInstanitateOnCancel)
    181.         {
    182.            
    183.             Instantiate(GameObjectToInstanitateOnCancel, Vector3.zero, Quaternion.identity);   
    184.         }
    185.     }
    186.    
    187.     void InstantiateOnFail ()
    188.     {
    189.        
    190.         Debug.Log("InstantiateOnFail");
    191.        
    192.         if(GameObjectToInstantiateOnFail)
    193.         {
    194.             Instantiate(GameObjectToInstantiateOnFail, transform.position, Quaternion.identity);   
    195.         }
    196.     }
    197.    
    198.     void InstantiateOnSuccess ()
    199.     {
    200.        
    201.         Debug.Log("InstantiateOnSuccess");
    202.        
    203.         if(GameObjectToInstantiateOnSuccess)
    204.         {
    205.             Instantiate(GameObjectToInstantiateOnSuccess, transform.position, Quaternion.identity);
    206.         }
    207.     }
    208.    
    209.     void Finish ()
    210.     {
    211.        
    212.         Debug.Log("Finish");
    213.        
    214.         if(SelfDestructOnFinish) Destroy(gameObject);
    215.     }
    216.  
    217. }
     
    Last edited: Nov 26, 2011
  11. blacksmithgames

    blacksmithgames

    Joined:
    Aug 30, 2009
    Posts:
    24
    Hi,

    I have problems with Facebook login.

    I'm doing this:

    PHP:
    FacebookBinding.loginWithRequestedPermissions( new string[] { "publish_stream""offline_access" } );
    After that Safari will open and the facebook page asks me if i want to use this app. I click on "OK" and after that Safari tells me that it can't open the URL.

    What I'm doing wrong?

    p.s.: The facebook key is the right one ;-)
     
  12. prime31

    prime31

    Joined:
    Oct 9, 2008
    Posts:
    6,426
    @Ola, that is some odd behavior indeed. Does the demo scene exhibit the same behavior? Have you tried swapping the http to https in the source code (we have an update glint out today that does this)?
     
  13. OlaAtKongotec

    OlaAtKongotec

    Joined:
    Nov 25, 2011
    Posts:
    19
    @prime[31] Thank you for the amazingly fast answer. The demo scene (after i added a button with TwitterBinding.login( Username, Password ); as this kind of login was missing from the demo) reacts the same way, with the "Twitter post failed: Could not authenticate you." error.

    Changing https://twitter to http://twitter inside Xcode throws error message

    Twitter login failed: <?xml version="1.0" encoding="UTF-8"?>
    <hash>
    <error>SSL required</error>
    <request>/oauth/access_token</request>
    </hash>
     
  14. prime31

    prime31

    Joined:
    Oct 9, 2008
    Posts:
    6,426
    @Ola, are you sure you got Xauth approval? I haven't seen anyone convince Twittet to allow them to use Xauth in a while. You got the change backwards with regard to the protocol: swap the "http" for "https" in the (I believe) 3 Twitter API URLs.
     
  15. OlaAtKongotec

    OlaAtKongotec

    Joined:
    Nov 25, 2011
    Posts:
    19
    @prime[31] Thanks Again! Changing the http:// to https:// on the api.twitter.com urls inside Xcode solved the problem.

    Twitter was very odd during the request phase, first denying, probably because I didn't attach a link to a screenshot of the twitter integration, and mentioned that graphics might differ in the final release.

    Then I requested again, when only twitter integration was left on my checklist, and got "Hello! Friendly reminder: your request 'Requesting xAuth' is pending and we are waiting for a response from you in order to proceed. Once you reply with the information we need, we can continue assisting you."

    I answered "Please specify the information you need me send you, to proceed with the request.", and their answer was "Hello, Thank you for writing in. Your application now has the ability to use xAuth, and our documentation is available here: https://dev.twitter.com/docs/oauth/xauth ."

    Although nothing changed information wise on the developer twitter app page ( I Think... ).
     
    Last edited: Nov 26, 2011
  16. gateway69

    gateway69

    Joined:
    Feb 18, 2010
    Posts:
    94
    Hmm, trying out this on my ipad today, had my app set up on fb, added the fb<app id> to the the info.plist additions, hit save, added the 2 test scenes and built it with xcode.. for ios5..

    when I hit init on the unity app I dont see anything happen in the console.. clicking log in, takes me to the native facebook app installed on the my ipad and has a small dialog box that says "An Error occurred, please try again later"

    Looking in the console im seeing this data..

    Code (csharp):
    1.  
    2.  
    3. System.Core.dll (this message is harmless)
    4. -> force accelerometer registration
    5. -> applicationDidBecomeActive()
    6. Facebook is logged in: False
    7.  
    8. (Filename: /Applications/buildAgent/work/842f9557127e852/Runtime/ExportGenerated/iPhonePlayer-armv7/UnityEngineDebug.cpp Line: 34)
    9.  
    10. -> applicationDidResignActive()
    11. -> applicationDidEnterBackground()
    12. -> applicationWillEnterForeground()
    13. -> applicationDidBecomeActive()
    14. 2011-11-28 19:14:06.105 testme[8604:707] error description: Error Domain=facebookErrDomain Code=10000 "The operation couldn’t be completed. (facebookErrDomain error 10000.)" UserInfo=0x1c520d0 {error=<CFBasicHash 0x1c534e0 [0x3fa90630]>{type = mutable dict, count = 2,
    15. entries =>
    16.     2 : <CFString 0x1c53f30 [0x3fa90630]>{contents = "type"} = <CFString 0x1c52200 [0x3fa90630]>{contents = "OAuthException"}
    17.     3 : <CFString 0x1c52260 [0x3fa90630]>{contents = "message"} = <CFString 0x1c52300 [0x3fa90630]>{contents = "An active access token must be used to query information about the current user."}
    18. }
    19. }
    20. 2011-11-28 19:14:06.107 testme[8604:707] error userInfo: {
    21.     error =     {
    22.         message = "An active access token must be used to query information about the current user.";
    23.         type = OAuthException;
    24.     };
    25. }
    26. Facebook failed to receive username: The operation couldn’t be completed. (facebookErrDomain error 10000.)
    27.  
    28. [CODE]
     
  17. gateway69

    gateway69

    Joined:
    Feb 18, 2010
    Posts:
    94
    Hmm, trying out this on my ipad today, had my app set up on fb, added the fb<app id> to the the info.plist additions, hit save, added the 2 test scenes and built it with xcode.. for ios5..

    when I hit init on the unity app I dont see anything happen in the console.. clicking log in, takes me to the native facebook app installed on the my ipad and has a small dialog box that says "An Error occurred, please try again later"

    Looking in the console im seeing this data..

    Code (csharp):
    1. System.Core.dll (this message is harmless)
    2. -> force accelerometer registration
    3. -> applicationDidBecomeActive()
    4. Facebook is logged in: False
    5.  
    6. (Filename: /Applications/buildAgent/work/842f9557127e852/Runtime/ExportGenerated/iPhonePlayer-armv7/UnityEngineDebug.cpp Line: 34)
    7.  
    8. -> applicationDidResignActive()
    9. -> applicationDidEnterBackground()
    10. -> applicationWillEnterForeground()
    11. -> applicationDidBecomeActive()
    12. 2011-11-28 19:14:06.105 testme[8604:707] error description: Error Domain=facebookErrDomain Code=10000 "The operation couldn’t be completed. (facebookErrDomain error 10000.)" UserInfo=0x1c520d0 {error=<CFBasicHash 0x1c534e0 [0x3fa90630]>{type = mutable dict, count = 2,
    13. entries =>
    14.     2 : <CFString 0x1c53f30 [0x3fa90630]>{contents = "type"} = <CFString 0x1c52200 [0x3fa90630]>{contents = "OAuthException"}
    15.     3 : <CFString 0x1c52260 [0x3fa90630]>{contents = "message"} = <CFString 0x1c52300 [0x3fa90630]>{contents = "An active access token must be used to query information about the current user."}
    16. }
    17. }
    18. 2011-11-28 19:14:06.107 testme[8604:707] error userInfo: {
    19.     error =     {
    20.         message = "An active access token must be used to query information about the current user.";
    21.         type = OAuthException;
    22.     };
    23. }
    24. Facebook failed to receive username: The operation couldn’t be completed. (facebookErrDomain error 10000.)
    25.  
     
  18. prime31

    prime31

    Joined:
    Oct 9, 2008
    Posts:
    6,426
    @gateway, the official Facebook app is having login issues right now. If you delete it from your device temporarily the login process will use Safari which is working properly.
     
  19. gateway69

    gateway69

    Joined:
    Feb 18, 2010
    Posts:
    94
    Thanks for the reply, so are you saying anyone that would be wanting to play our game now and has the facebook official app on their iOS device would have to delete it and run our game, auth with fb via safari, then install the facebook app again? seems like well we would loose a lot of customers... is their a way to force it to load safari ?
     
  20. prime31

    prime31

    Joined:
    Oct 9, 2008
    Posts:
    6,426
    @gateway, a quick workaround that should get you running is to remove the Facebook app from the auth process. To do this, open the Facebook.m file and location line 275 (the authorize:(NSArray*)permissions method). Change it to be the following:


    Code (csharp):
    1. - (void)authorize:(NSArray *)permissions
    2. {
    3.     self.permissions = permissions;
    4.  
    5.     [self authorizeWithFBAppAuth:NO safariAuth:YES];
    6. }
     
  21. gateway69

    gateway69

    Joined:
    Feb 18, 2010
    Posts:
    94
    odd, ok made the change Safari popped up, and error at the top of the page says

    "An error occurred please try again later" this is similar to the error I saw, when looking at the URL in Safari client_id = YOUR_APP_ID_HERE which im assuming that my fb id isnt getting properly passed to fb for auth..

    Looking at my , Prime31 info.plist I added size 1 , and for element 1 I put in fb + my app id, xcode it shows under URL schemes.. Item 0 string then fb app id..
     
  22. prime31

    prime31

    Joined:
    Oct 9, 2008
    Posts:
    6,426
    @gateway, until things work you have to delete the app from your device between tests so the new Info.plist values get copied over. Ensure that the URL schemes are present in the actual Info.plist.
     
  23. Kevpearman

    Kevpearman

    Joined:
    Dec 9, 2009
    Posts:
    44
    Im' having problems posting scores to facebook via the graphRequest method and wondered if someone could point me in the right direction. I've got the callbacks working OK because i can fire off a ME request and i can retrieve all scores for my app but i'm getting an error when trying to publish scores

    Code (csharp):
    1. Hashtable ht = new Hashtable();
    2. ht.Add("score", 400);
    3. FacebookBinding.graphRequest("/" + UserID + "/scores", "POST", ht); //I've tried this with and without the preceeding "/"
    The error i'm getting is
    -[NSDecimalNumber length]: unrecognized selector sent to instance 0x1df1180
    *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[NSDecimalNumber length]: unrecognized selector sent to instance 0x1df1180'

    According to the documentation on facebook i just need to post the score as above
    Create or update a score for a user

    You can post a score or a user by issuing an HTTP POST request to /USER_ID/scores with the app access_token as long as you have the publish_actions permission.


    name description type required
    score numeric score with value > 0. integer yes



    To be honest i feel a bit silly asking because this stuff should be really simple but for some reason i seem to be struggling with it :( . I won't get chance to investigate the problem for a couple of hours because i'm at work so hopefully someone can point me in the right direction by then!
     
  24. Kevpearman

    Kevpearman

    Joined:
    Dec 9, 2009
    Posts:
    44
    Looking at the error (probably should have done that a bit more before posting! :eek: it's probably to do with me passing the score in as a number rather than a string, when i get chance i will try score.ToString() rather than passing the actual score integer in.

    If anyone has any thoughts in the mean time then let me know otherwise i'll give it a bash in a bit
     
  25. Kevpearman

    Kevpearman

    Joined:
    Dec 9, 2009
    Posts:
    44
    Well that worked, i never thought to convert the int to a string explicitly, you get so used to stuff like that being handled for you when writing C# windows apps all day.

    My graphRequest now looks like this

    Code (csharp):
    1.  
    2. Hashtable ht = new Hashtable();
    3. ht.Add("score", "400");
    4. ht.Add("access_token", FacebookBinding.getFacebookAccessToken());
    5.            
    6. print("Hastable JSON: " + ht.toJson());
    7. FacebookBinding.graphRequest("/" + UserID + "/scores", "POST", ht);
    but i'm getting the following error
    error description: Error Domain=facebookErrDomain Code=10000 "The operation couldn’t be completed. (facebookErrDomain error 10000.)" UserInfo=0xac83c00 {error=<CFBasicHash 0x1c0bfd0 [0x3f796630]>{type = mutable dict, count = 2,
    entries =>
    2 : <CFString 0xac7f650 [0x3f796630]>{contents = "type"} = <CFString 0xac83ae0 [0x3f796630]>{contents = "OAuthException"}
    3 : <CFString 0xac83a80 [0x3f796630]>{contents = "message"} = <CFString 0x1c03220 [0x3f796630]>{contents = "(#15) This method must be called with an app access_token."}


    However as you can see i'm putting the app's access_token into the hashtable.
    Anyone got any ideas what i'm doing wrong? I really want to get this finished so i can publish the app, the facebook integration is all that's not finished.
     
  26. prime31

    prime31

    Joined:
    Oct 9, 2008
    Posts:
    6,426
    @Kev, there is no need to add the access token. The plugin will handle that for you. Error 10000 is almost always a permissions issue. Make sure you are requesting the required permissions for the method.
     
  27. Kevpearman

    Kevpearman

    Joined:
    Dec 9, 2009
    Posts:
    44
    I thought it might be something like that, nice to know the access token is included.
    I requested the publish_actions permission and got an error in my facebook app, nothing specific just that an error had occurred and nothing came through to the console window.

    Any ideas? Is this related to the problems Gateway69 was having?
     
  28. prime31

    prime31

    Joined:
    Oct 9, 2008
    Posts:
    6,426
    @Kevpearman, you may want to shoot an email over to the Facebook crew. They would know for sure what is going on. There isn't much visibility from the outside.
     
  29. Kevpearman

    Kevpearman

    Joined:
    Dec 9, 2009
    Posts:
    44
    Prime, i managed to get the app logging in with the correct credentials, updated my facebook app on my phone as well as the version of your plugin i was using and i can now do

    Code (csharp):
    1. loginWithRequestedPermissions(new string[]{"publish_actions, user_games_activity"});
    I added the second permission, user_games_activity because publish actions doesn't pop up anything additional to the default login page and i wanted to bee 100% sure that it was working.

    However, i'm still getting a 10000 error.

    The failed event handler has the following error

    Code (csharp):
    1. The operation couldn’t be completed.
    And the output window also has the following in it, this time requesting the app access_token which i have since taken out of my hashtable as you suggested

    Code (csharp):
    1. error description: Error Domain=facebookErrDomain Code=10000 "The operation couldn’t be completed. (facebookErrDomain error 10000.)" UserInfo=0x30069c0 {error=<CFBasicHash 0x3008b50 [0x3f796630]>{type = mutable dict, count = 2,
    2. entries =>
    3.     2 : <CFString 0x300bff0 [0x3f796630]>{contents = "type"} = <CFString 0x300be20 [0x3f796630]>{contents = "OAuthException"}
    4.     3 : <CFString 0x300bdc0 [0x3f796630]>{contents = "message"} = <CFString 0x30079a0 [0x3f796630]>{contents = "(#15) This method must be called with an app access_token."}
    5. }
    6. }
    7. 2011-12-03 14:53:44.787 poppinpressies[1719:707] error userInfo: {
    8.     error =     {
    9.         message = "(#15) This method must be called with an app access_token.";
    10.         type = OAuthException;
    11.     };
    12. }
    Here's the code i am using to post a score

    Code (csharp):
    1. Hashtable ht = new Hashtable();
    2.             ht.Add("score", LevelManager.GetInstance().Score.ToString());
    3.             //ht.Add("access_token", FacebookBinding.getFacebookAccessToken());
    4.            
    5.             print("Hastable JSON: " + ht.toJson());
    6.             FacebookBinding.graphRequest("/" + UserID + "/scores", "POST", ht);
    and you've already seen the code i'm using to log in and request the publish_actions permission, which i believe is all that is required to publish scores for users.

    I can get scores for users i just can't publish them, any thoughts on this would be much appreciated. Once the app is live with facebook support (hopefully this side of xmas) i will be purchasing your gamecentre plugin so i can have a go at that side of things before i move onto my next app. By then i should have a reasonable framework for social networking, game centre etc all ready to plug my next game into.

    Cheers


    Kev
     
  30. prime31

    prime31

    Joined:
    Oct 9, 2008
    Posts:
    6,426
    @kev, as mentioned previously I have no visibility into the Graph API. The plugin will shuttle the request to the Graph API but its a black box from there. To get details on what is happening you will need to open a bug with the Facebook iOS team.
     
  31. Kevpearman

    Kevpearman

    Joined:
    Dec 9, 2009
    Posts:
    44
    OK prime i'll raise a ticket, i was just making sure i wasn't doing anything stupid before i talked to the facebook folks. I'll let you know what they say in case anyone else has these problems, i imagine there are a few people on these forums using your plugin for facebook scoreboards
     
  32. egomen

    egomen

    Joined:
    Dec 9, 2011
    Posts:
    3
    hi Prime;

    i bought your Social network plugin but i couldnt use it.i also sent 2 messages from your site .can you write me a detailed list of what should i do about it ?i just want to share something on facebook wall .which steps should i follow if you please write me step by step i have to finish it soon i am waiting for your answer.
     
  33. egomen

    egomen

    Joined:
    Dec 9, 2011
    Posts:
    3
    or if there is another friend who knows what i should do would be great i am waiting for your answers thanks in advance
     
  34. prime31

    prime31

    Joined:
    Oct 9, 2008
    Posts:
    6,426
    @egoman, I already responded to your PM. You need to read through the documentation and properly setup your Facebook app, URL scheme and make sure your provisioning profile and bundle IDs match up.
     
  35. Griffith

    Griffith

    Joined:
    Oct 19, 2011
    Posts:
    23
    Prime, it seems that on the Android version of your plugin the getUsername() function is returning the name of the user (Real name) rather than username.

    This is different to the IOS version which does return the username. Meaning the interface I've written between the two plugin types doesn't work correctly because of their differing behaviour between the two functions.

    Cheers
     
    Last edited: Dec 12, 2011
  36. prime31

    prime31

    Joined:
    Oct 9, 2008
    Posts:
    6,426
    @Griffith, you can use the performRequest method to access the users entire profile. The getUsername method is just a demonstration of what is possible.
     
  37. Griffith

    Griffith

    Joined:
    Oct 19, 2011
    Posts:
    23
    Ok but I think my point still stands that the getUsername function is not actually returning a username and should probably be renamed or removed as it's quite confusing and cost me a bit of time since I was assuming that what it would be doing just like the other version of he plugin does :) I guess I'll go ahead and code a get username myself for the android version of the interface
     
  38. voiceofthesoul

    voiceofthesoul

    Joined:
    Oct 6, 2011
    Posts:
    1
    Hi, i just bought your Social Network Plugin for both Android and IOS

    However, i could not import your package

    It gives this error while decompressing unity archive :

    "Error while importing package: Couldn't decompress package"

    Please Help!
     
  39. prime31

    prime31

    Joined:
    Oct 9, 2008
    Posts:
    6,426
    @voice, I believe I responded to your email already so be sure to check it.
     
  40. Shaitaaan

    Shaitaaan

    Joined:
    Apr 29, 2009
    Posts:
    26
    Hey Prime,

    You should have a forum of your own. It's a royal pain searching for solutions in 30 pages.
    Please consider it.

    Sincerely,
    Lost developer ;-)
     
  41. prime31

    prime31

    Joined:
    Oct 9, 2008
    Posts:
    6,426
  42. Kevpearman

    Kevpearman

    Joined:
    Dec 9, 2009
    Posts:
    44
    @prime, i raised a ticket with facebook and they've said that the app access token is not being passed through as per the description in the error message. I dno't have access to the code you are using to submit the graph request so i can't give them any more feedback, can you generate a graph request to post scores to a facebook app and let me have the contents of the request as they are submitted to facebook? That way if you are sending through the app access token i can ask them to investigate further, if you aren't then the problem lies in your plugin.

    Cheers


    Kev
     
  43. Kevpearman

    Kevpearman

    Joined:
    Dec 9, 2009
    Posts:
    44
    @prime, Here's the post with the error message in it to save you looking back through the thread!

     
  44. Shaitaaan

    Shaitaaan

    Joined:
    Apr 29, 2009
    Posts:
    26
    @prime,

    thanks for the link.
    I found what I was looking for. But every time I try to find some help on a 3rd party plugin issue, I have to browse through one post which has multiple issues being discussed at a time.
     
  45. prime31

    prime31

    Joined:
    Oct 9, 2008
    Posts:
    6,426
    @Kev, right from Facebook's own source code on line 139 of Facebook.m you can clearly see the accessToken is appended to every request:

    Code (csharp):
    1.   if ([self isSessionValid]) {
    2.     [params setValue:self.accessToken forKey:@"access_token"];
    3.   }
    I have made many, many graph requests without ever manually adding the access token in Unity with no issues.
     
  46. Kevpearman

    Kevpearman

    Joined:
    Dec 9, 2009
    Posts:
    44
    Which is why i need the debug output of a request sent to post a highscore to facebook. They are saying the property isn't being set, you are saying it is and i'm stuck in the middle. I can send you any details you require but i need the output of the facebook graph request to post a highscore just before it is posted to facebook so that i can go back to them and prove that what your plugin is sending is correct. Then hopefully they will give me an answer as to what the problem actually is, until i show them what's being posted they will just keep telling me that the token isn't being passed in, or that it isn't being passed in correctly.
     
  47. prime31

    prime31

    Joined:
    Oct 9, 2008
    Posts:
    6,426
    @kev, feel free to send over a demo project it you could just dump the output by adding the following right below the lines I posted previously:

    NSLog( @"dump: @%", params );
     
  48. UVRadiation

    UVRadiation

    Joined:
    Jul 21, 2008
    Posts:
    183
    Hi Prime,
    I'm trying to use the SocialNetworking plugin to send app requests, everything else seems to be working, but not the requests dialog.
    I am using the following code :

    Code (csharp):
    1.        
    2. Dictionary<string, string> dictionary = new Dictionary<string, string>();
    3. dictionary.Add("message","test me");
    4. dictionary.Add("title","some Title");  
    5. dictionary.Add("to","[someID,someOtherId]");  
    6. FacebookBinding.showDialog("apprequests",dictionary);
    The dialog is showing in a popup and not as stated in the facebook API : http://developers.facebook.com/docs/mobile/screenshots/ios/

    I do get a DialogCompleted event when I click send but the requests dont actually get sent.
    When I tried the same without providing the "To" parameter the fb docs state that it should open a multiuser selection dialog, but I get the same window but with the friends selector missing or partially working on some devices (f.e search dosent work")
    Anyone has an idea what I'm doing wrong? anyone did manage to use this dialog without problems? is there something related to the requests 2.0 api that I should be aware of?

    * I tried using @"apprequests" as the method with the same result.
    Thanks!
     
  49. prime31

    prime31

    Joined:
    Oct 9, 2008
    Posts:
    6,426
    @UV, the page you linked to is showing the Facebook web page, not the Facebook dialog page. There isn't anything in the docs that I saw that tells what is different between a dialog and it's actual web page counterpart. I can't really provide any info with regard to the dialog. Once you show the dialog all the rest o the actions occur on Facebooks website. You may have to shoot them an email to get the details of what is happening.
     
  50. Xantec

    Xantec

    Joined:
    Aug 2, 2011
    Posts:
    39
    Ive been trying to resolve this problem with twitter for about 2 days now. I cant seem to find anything on it. When using oAuth login it says to return to the app and enter the PIN it gives me, but there it no dialogue for that or anything. Any help?(Im using JS)