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. Dismiss Notice

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

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

  1. FromSkyToEnd

    FromSkyToEnd

    Joined:
    May 2, 2013
    Posts:
    3
    Hello, since the past few months I've notice the app I'm working on would only use webview for login... no matter what ios, iphone or ipad, native account logged in or not and facebook app installed or not... it always uses webview. I have in my facebook settings for the app enabled the single sign-on so it would use the facebook app or native account to get the proper facebook credentials.

    What do I have to do to call facebook login so it runs properly? I read that prime31 is not responsible for how it log's in the user, but facebook also says it should login using the appropriate methods so what is causing this?

    Is there any solutions to this? Perhaps there is something i am missing. I would also gladly give out example if they are needed.

    In addition to this problem, a few days ago I started getting a 500 internal server error, i tried making the facebook api do a debug log of it but there was no more information... There was no change to the networking code before and after this error occured for the first time, i even updated the plugin today but to no success. Any information as to how i could fix this? or at least why it might happen?
     
  2. prime31

    prime31

    Joined:
    Oct 9, 2008
    Posts:
    6,426
    @fromsky, you can force different login behaviours by using the setSessionLoginBehavior method. As for a 500 error on Facebook's servers obviously there isn't anything we can do about that. You need to contact Facebook directly.
     
  3. Eltayeb

    Eltayeb

    Joined:
    Jan 24, 2014
    Posts:
    20
    Hello i been working with the social networking plugin and when i try to call the graphRequest function the on complete function does not fire would u know why that happen
     
  4. prime31

    prime31

    Joined:
    Oct 9, 2008
    Posts:
    6,426
    @eltayeb, please provide the full log output and steps to reproduce using the demo scene.
     
  5. Eltayeb

    Eltayeb

    Joined:
    Jan 24, 2014
    Posts:
    20
    well after tracking the problem i discovered that when i use both vuforia and social networking plugins this problem happens so i need them both to work an pointers ?
     
  6. prime31

    prime31

    Joined:
    Oct 9, 2008
    Posts:
    6,426
    @eltayeb, I have no idea what Vuforia is doing under the covers.
     
  7. chirhotec

    chirhotec

    Joined:
    Mar 30, 2010
    Posts:
    47
    I apologize if this has been discussed before, but I couldn't seem to find a search combination to find it.

    I'm using the Combo Social Networking Plugin and currently testing on iOS 7 with the Facebook App installed, a user logged in via the system settings and the default session login behavior. So, its using the native authentication via the pop up dialog.

    The issue is that when I log in, my application is receiving email, birhtday and location permissions, even though I'm not asking for them, and the pop up dialog doesn't seem to indicate asking for them either ("Your App" would like to access your basic profile info and list of friends). The extra granted permissions can be seen when visiting the app settings at https://www.facebook.com/appcenter/my (and yes, I did clear out all permissions between tests).

    I've tried both of the following, but both are producting the same issue:
    Code (csharp):
    1. FacebookCombo.login()
    Code (csharp):
    1. FacebookCombo.loginWithReadPermissions( new string[] { "basic_info" } );
    I am not getting the extra permissions if I sign my user out of the iOS system settings, or manually force the use of the facebook app / web client auth via
    Code (csharp):
    1. FacebookBinding.setSessionLoginBehavior(FacebookSessionLoginBehavior.WithNoFallbackToWebView);
    Any ideas?
     
    Last edited: Feb 11, 2014
  8. prime31

    prime31

    Joined:
    Oct 9, 2008
    Posts:
    6,426
    @chirhotec, you will want to open a bug report directly with Apple if you are getting extra permissions that you didn't ask for. It may be that's just how they do things with native auth and it may be a bug associated with your app but only Apple can tell you that. The plugin will never, ever under any circumstance just add permissions to authentication without you specifying them.
     
  9. strelkin7

    strelkin7

    Joined:
    Feb 12, 2014
    Posts:
    1
    Hi to all!
    Can I use russian or chinese text in params for FacebookBinding.showFacebookShareDialog?
    When I try to write something like this:
    Code (csharp):
    1.            
    2. Dictionary<string, object> parameters = new Dictionary<string, object>
    3. {
    4.     { "link",        FB_LINK },
    5.     { "name",     PRODUCTION_FB_NAME },
    6.     { "picture",   IMAGE_LINK },
    7.     { "caption",     some_russian_or_chinese_text},
    8.     { "description", some_russian_or_chinese_text }
    9. };
    10.  
    11. FacebookBinding.showFacebookShareDialog(parameters);
    12.  
    I just get an error:

    "Failed to deserialize JSON
    ....
    with error: Error Domain=NSCocoaErrorDomain Code=3840 "The operation couldn’t be completed. (Cocoa error 3840.)"

    Thanks in advance
     
  10. prime31

    prime31

    Joined:
    Oct 9, 2008
    Posts:
    6,426
    @strelkin, NSCocoaErrorDomain 3840 almost always means there is a string encoding issue. The first thing I would do is log the full string from the showFacebookShareDialog method (Debug.Log( parameters.toJson()) and give it a look to see what's in there and make sure no non-UTF8 characters exist.
     
  11. kleinfb

    kleinfb

    Joined:
    Sep 21, 2012
    Posts:
    96
    Hello folks. First of all, thank you and congratulations for the awesome plugin.

    I am going crazy with the parsing trouble. I know this is not exactly your problem, but if you could just take a look and maybe show me what I am doint wrong, I would really appreciate it.

    First, I perform a request for list of friends, and check if they have the app installed:

    Code (csharp):
    1. Facebook.instance.graphRequest("me/friends?fields=installed,name", Prime31.HTTPVerb.GET, gotFriendsListCompletionHandler);
    Afther that, request is sent and successfull, so here is the output:

    Now, everywhere I look at it, we have the result being cast into a Hashtable, and an ArrayList being created using "data" as the key for the hashtable.

    So I am trying something like this, WITH the debugs, to see what is going on:

    Code (csharp):
    1.         Debug.Log("attempt to create  __hashData");
    2.         Hashtable __hashData = result as Hashtable;
    3.         Debug.Log("__hashdatasize data: " + __hashData["data"]);
    4.  
    5.         Debug.Log("attempt to create __arraylist");
    6.         ArrayList list = __hashData["data"] as ArrayList;
    7.         Debug.Log("arrayList size: " + list.Count);
    But I only get the first message. When I try to init __hashData, I get a bad memory access and app crashes (I have trie accesing __hashData in many different ways, always the same problem).

    So my question would be, what exactly am I dong wrong? How should I try to access that data?

    Situation is a bit critical, so your help would be much, much appreciated.

    Thanks everyone.
     
  12. prime31

    prime31

    Joined:
    Oct 9, 2008
    Posts:
    6,426
    @klein, all data returned is in Generic containers: Dictionary<string,object> and List<object>. That is probably why you are running into issues parsing the data.
     
  13. kleinfb

    kleinfb

    Joined:
    Sep 21, 2012
    Posts:
    96
    Right. And on that specific case, in which I try to cast the resulte like " Hashtable __hashData = result as Hashtable;"

    What actual type should I cast that? That is the part in which all of the example I have seen it get that as a hashtable. But on my case, trying to get the "result" parameter as a hashtable fails :/ so a specific question is "what data type should I cast the results into, first of all?" - again, much appreciate and need your help.

    Best regards
     
  14. prime31

    prime31

    Joined:
    Oct 9, 2008
    Posts:
    6,426
    @klein, a Hashtable is essentially the non-generic version of Dictionary. So:

     
  15. kleinfb

    kleinfb

    Joined:
    Sep 21, 2012
    Posts:
    96
    Thank you! I will check that shortly, and return to tell how that ended up.

    I leave here a suggestion of you guys creating a video about some simple facebook request, like mine, being handled and saved into a custom class. As much as it goes beyond the plugin's purpose, the community would be really glad (I am sure this is not the first time someone is a bit troubled with that), and it would encourage even more persons to use that. I also saw the json encoding/decoding classe, but was not able to handle that too, this is really not my area of expertise. Maybe using that, to achieve something similar to what I am trying to do, would be of great use. Please consider that :)

    Either way, thanks a lot, and congrats for the great work.
     
  16. prime31

    prime31

    Joined:
    Oct 9, 2008
    Posts:
    6,426
    @klein, there is already that exact video on our YouTube account (prime31studios). In addition, the plugin comes with several strongly typed Graph API requests as an example of how to do it. See the "me" request in the Facebook class for an example.
     
  17. Eltayeb

    Eltayeb

    Joined:
    Jan 24, 2014
    Posts:
    20
    Hello, i'm having a weird problem. i have a button on my game that should log the player on facebook when i press it the game redirects me to safari or facebook app normally then i authorize the app then i get redirected again to the game. when i get back into the game a facebook login dialog box shows inside and freezes the game.
     
  18. prime31

    prime31

    Joined:
    Oct 9, 2008
    Posts:
    6,426
    @eltayeb, I know I sound like a broken record in this thread but I can't help with no information. Full log output and steps to reproduce are the bare minimim required.
     
  19. kleinfb

    kleinfb

    Joined:
    Sep 21, 2012
    Posts:
    96
    Hi there.

    Well, I have to say I saw the json serialize/desirialize video, and it is not at all to exactly what I suggested to be shown. It just decodes and encodes some custom class, but I do not see how to connect that to the response of a graph request to use it properly. Like I said, the specific situation I just mentioned is not something that I am the only person struggling with, and as much as that would go beyond the plugin proposal, that would me much appreciated and surely something to increase accessibility to the plugin.
     
  20. helioxfilm

    helioxfilm

    Joined:
    Apr 23, 2008
    Posts:
    259
    Dear Mike,

    we are using your plugin in our 3.5.7 Unity project. However, in the last days it does not work properly, and we cannot post on the wall, share photos. Xcode says that we have an invalid app id. I have triple checked, everything is set up fine in the plist. We cannot update to the latest version of your plugin, because then we would need to recreate the whole project in Unity 4 which would be a huge work (at least a month) and simply cannot justify the costs.

    This is the error I got in Xcode. Could you help us somehow? This is the last unsolved issue, whitout solving this we cannot submit to the store.

    2014-02-17 08:00:13.365 divemaster[7009:60b] session creation error: Error Domain=com.facebook.sdk Code=2 "The operation couldn’t be completed. (com.facebook.sdk error 2.)" UserInfo=0x1cbbcf20 {com.facebook.sdk:ErrorLoginFailedReason=com.facebook.sdk:SystemLoginCancelled, com.facebook.sdk:ErrorInnerErrorKey=Error Domain=com.apple.accounts Code=7 "The Facebook server could not fulfill this access request: invalid app id" UserInfo=0x1caf7e20 {NSLocalizedDescription=The Facebook server could not fulfill this access request: invalid app id}, com.facebook.sdk:ErrorSessionKey=<FBSession: 0x1cb05750, state: FBSessionStateClosedLoginFailed, loginHandler: 0x0, appID: 370700766394841
    370700766394841
    370700766394841, urlSchemeSuffix: , tokenCachingStrategy:<FBSessionTokenCachingStrategy: 0x175aa350>, expirationDate: (null), refreshDate: (null), attemptedRefreshDate: 0001-12-30 00:00:00 +0000, permissions:(null)>} userInfo: {
    "com.facebook.sdk:ErrorInnerErrorKey" = "Error Domain=com.apple.accounts Code=7 \"The Facebook server could not fulfill this access request: invalid app id\" UserInfo=0x1caf7e20 {NSLocalizedDescription=The Facebook server could not fulfill this access request: invalid app id}";
    "com.facebook.sdk:ErrorLoginFailedReason" = "com.facebook.sdk:SystemLoginCancelled";
    "com.facebook.sdk:ErrorSessionKey" = "<FBSession: 0x1cb05750, state: FBSessionStateClosedLoginFailed, loginHandler: 0x0, appID: 370700766394841\n370700766394841\n370700766394841, urlSchemeSuffix: , tokenCachingStrategy:<FBSessionTokenCachingStrategy: 0x175aa350>, expirationDate: (null), refreshDate: (null), attemptedRefreshDate: 0001-12-30 00:00:00 +0000, permissions:(null)>";
    }
    -> applicationDidBecomeActive()
    FB -- login failed: [P31Error]: {
    "message": "The operation couldn’t be completed. (com.facebook.sdk error 2.)",
    "_containsOnlyMessage": false,
    "<message>k__BackingField": "The operation couldn’t be completed. (com.facebook.sdk error 2.)",
    "<domain>k__BackingField": "com.facebook.sdk",
    "<code>k__BackingField": 2,
    "<userInfo>k__BackingField":
    {
    "com.facebook.sdk:ErrorLoginFailedReason": "com.facebook.sdk:SystemLoginCancelled"
    }
    }
     
  21. prime31

    prime31

    Joined:
    Oct 9, 2008
    Posts:
    6,426
    @heliox, all I can tell you is exactly what the error is saying: your app ID is not valid.

     
  22. helioxfilm

    helioxfilm

    Joined:
    Apr 23, 2008
    Posts:
    259
    But how can it be? it was ok, than after some days, it is not ok? the app id is identical. Should we delete the Facebook app, make a new one?

    Edit: I created a new app. At the iOS app id if I set the app id, Facebook says, it can not retrieve it (it is not out yet). Ok, I leave it empty. Xcode repeats again the same error.

    However, if I check my other project, which is in unity 4.3.4, the plugin works well, and that app is also under review, so not out yet...
     
    Last edited: Feb 17, 2014
  23. helioxfilm

    helioxfilm

    Joined:
    Apr 23, 2008
    Posts:
    259
    Well, after diving into the stackoverflow's page, I got a tip: reset the secret key at the Facebook App. I am very-very happy to report that it solved my problem...
     
    Last edited: Feb 18, 2014
  24. kleinfb

    kleinfb

    Joined:
    Sep 21, 2012
    Posts:
    96
    Mr. Prime, I am afraid I will have to bother you again :/

    I want a suggestion from you... all of this data parsing can be very troublesome and so... and well, it takes a lot of time to change a line of code and recompile etc etc...

    Can you think of a way where I could retrieve the actual data that facebook send me, and save it, so that I can work with that on the editor, being "offline"?

    My best regards, thank you for your patience.
     
  25. prime31

    prime31

    Joined:
    Oct 9, 2008
    Posts:
    6,426
    @kleinfb, you can set Facebook.instance.accessToken to any valid access token for testing in the Editor.
     
  26. kleinfb

    kleinfb

    Joined:
    Sep 21, 2012
    Posts:
    96
    ok, I get the valid access token, and then what?
     
  27. shadowfork

    shadowfork

    Joined:
    Jan 8, 2010
    Posts:
    167
    Does anybody know why

    TwitterBinding.postStatusUpdate( "Hello world!" + Time.deltaTime );

    works but

    TwitterBinding.postStatusUpdate( message, filePath );

    doesn't?

    The filePath is correct, the screenshot exists. But for some reason I couldn't post with an image but regular text works.

    I also noticed 'Post' button is ghosted.

    I checked:
    • Logged In is TRUE
    • app is Authorized
    • I can retrieve username
    • BUT TwitterBinding.canUserTweet() is always FALSE

    Anyone? Mike?
     
  28. shadowfork

    shadowfork

    Joined:
    Jan 8, 2010
    Posts:
    167
    Just to add more details:

    • Permission set to: Read Write
    • Created access tokens
    • I've set a callback URL
    • Single sign in is enabled
    • Checked 'Allow app to sign in'
     
  29. prime31

    prime31

    Joined:
    Oct 9, 2008
    Posts:
    6,426
    @shadowfork, have you double checked your file path using File.Exists to ensure it is correct and can be found by the system? The canUserTweet method will only let you know if the user is logged into Twitter via the native iOS system. It only affects the showTweetComposer method. Seeing as how a text post works I am gonna guess that the file path is probably not correct. Give the demo scene a look to see a functioning example.
     
  30. shadowfork

    shadowfork

    Joined:
    Jan 8, 2010
    Posts:
    167
    Yes, I check with:

    if( !File.Exists( filePath ) )

    If it exists, I post. If not, I log the error. But it goes through...

    Here's what i get on my filePath:

    /var/mobile/Applications/66E9C989-8574-439D-A8D0-123456789111/Documents/02192014175817.png
     
  31. shadowfork

    shadowfork

    Joined:
    Jan 8, 2010
    Posts:
    167
    Also, I use the same filePath for the Facebook plugin and it posts fine over there.

    I'm giving the demo scene a whirl now. Brb.
     
  32. prime31

    prime31

    Joined:
    Oct 9, 2008
    Posts:
    6,426
    @shadow, are you varying the text and images that you are posting (or changing Twitter accounts)? Twitter will reject dupes. Also, all requests will fire either requestDidFailEvent or requestDidFinishEvent both of which contain much data. What is the data they are returning?
     
  33. shadowfork

    shadowfork

    Joined:
    Jan 8, 2010
    Posts:
    167
    $twitter.jpg

    I changed the text but POST button is still ghosted. I logged in on the system.app

    I see a thumbnail attachment which I assume we have a valid image capture for posting.

    Any clues?
     
  34. shadowfork

    shadowfork

    Joined:
    Jan 8, 2010
    Posts:
    167
    This also proves that the file path is correct because I'm still using the same variable for:

    TwitterBinding.showTweetComposer( message, filePath );

    So it's definitely not the file path.
     
  35. prime31

    prime31

    Joined:
    Oct 9, 2008
    Posts:
    6,426
    That looks like a lengthy message. Are you over the character count?
     
  36. shadowfork

    shadowfork

    Joined:
    Jan 8, 2010
    Posts:
    167
    Wow, you were absolutely right!

    But I counted the characters, as seen on the screenshotit's at 121 characters.

    Isn't the limit at 140? Or does it include the filename of the image add to that limitation?

    $Screen Shot 2014-02-19 at 7.00.35 PM.png
     
  37. shadowfork

    shadowfork

    Joined:
    Jan 8, 2010
    Posts:
    167
    Ah, yes, Twitter adds the image url on the character limit.

    Solved. Thank you so much Prime!
     
  38. kleinfb

    kleinfb

    Joined:
    Sep 21, 2012
    Posts:
    96
    I will have to ask again, excuse me for my persistence please.

    Once I set Facebook.instance.accessToken to any valid access token, what am I supposed to do in order to perform tests with prime 31 straight from the Unity editor?
     
  39. prime31

    prime31

    Joined:
    Oct 9, 2008
    Posts:
    6,426
    @klein, once you set Facebook.instance.accessToken just call any methods on the Facebook class to test right in the editor.
     
  40. WPCJack

    WPCJack

    Joined:
    Mar 15, 2013
    Posts:
    26
    Hey guys,

    Just reopened a project and without changing the code the new build is crashing with twitter functionality
    Code (csharp):
    1. got composer
    2.  
    3. (Filename: /Applications/buildAgent/work/d3d49558e4d408f4/artifacts/iPhonePlayer-armv7Generated/UnityEngineDebug.cpp Line: 53)
    4.  
    5. 2014-02-25 17:35:39.583 prototype[2161:60b] -[UnityAppController window]: unrecognized selector sent to instance 0x3579360
    6. 2014-02-25 17:35:39.587 prototype[2161:60b] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[UnityAppController window]: unrecognized selector sent to instance 0x3579360'
    7. *** First throw call stack:
    8. (0x2fca5e83 0x3a34f6c7 0x2fca97b7 0x2fca7f4d 0x2fbf6dc8 0x14149b1 0x148e133 0xcb3b2c 0x3e940 0x26098 0x76314 0x18e40 0x1c428 0x15b7c 0x15a08 0x10308 0xfd48 0x3641c 0x36448 0x36448 0x36448 0x36448 0x36448 0x36448 0x36448 0x36448 0x36448 0x36448 0x36448 0x36448 0x36448 0x36448 0x36448 0x36448 0x36448 0x36448 0x36448 0x36448 0x36448 0x36448 0x36448 0x36448 0x36448 0x19ce8 0x1f884 0xb30110 0x1272a38 0x1314a88 0xe2f008 0xec1070 0xec102c 0xeb6fe0 0xeb6ff8 0xe17cc0 0xe18018 0xe954d0 0xcdb914 0xc84a78 0xc84b4c 0x327d5ff 0x32100ad3 0x3210087d 0x34cfd76d 0x30987be5 0x2fc65b81 0x2fc70777 0x2fc70713 0x2fc6eedf 0x2fbd9471 0x2fbd9253 0x348e02eb 0x3248e845 0x97cc 0x96a8)
    9. libc++abi.dylib: terminating with uncaught exception of type NSException
    10. (lldb)
    I'm hoping its just me being dumb, let me know if you need more info. my code is below too

    Code (csharp):
    1. print("got here");
    2.                 //play select sound
    3.                 var pathToImage = Application.persistentDataPath + "/" + PluginMaster.levelScreenshot;
    4.                 if( TwitterBinding.isTweetSheetSupported()  TwitterBinding.canUserTweet())                 
    5.                 {
    6.                     print("got composer");
    7.  
    8.                     TwitterBinding.showTweetComposer( PluginMaster.shareText, pathToImage );
    9.                 }
    10.                 else if (TwitterBinding.isLoggedIn()) {
    11.                     print("got post status");
    12.  
    13.                     TwitterBinding.postStatusUpdate( PluginMaster.shareText + Time.deltaTime, pathToImage );
    14.                     PlayerPrefs.SetInt("KeysInInventory", 5 + PlayerPrefs.GetInt("KeysInInventory"));
    15.                     PlayerPrefs.Save();
    16.                 }
    17.                 else if(!TwitterBinding.isLoggedIn())
    18.                 {
    19.                     print("got tried to login");
    20.  
    21.                     //twitter CONSUMER_KEY and CONSUMER_SECRET!
    22.                     TwitterBinding.showLoginDialog();
    23.                 }
    24.                 else
    25.                 {
    26.                     print(TwitterBinding.loggedInUsername());
    27.                     TwitterBinding.logout();
    28.                 }
    It actually doesn't seem to matter whether I call composer or login, both crash.

    Cheers
     
  41. prime31

    prime31

    Joined:
    Oct 9, 2008
    Posts:
    6,426
    @wpc, are you up to date with your plugin installs? We removed all access to the window property since Unity for some reason doesn't follow the protocol on all versions and sometimes leaves it blank.
     
  42. WPCJack

    WPCJack

    Joined:
    Mar 15, 2013
    Posts:
    26
    Yeah, you were right. Plugins were out of date.

    Cheers!
     
  43. Empu

    Empu

    Joined:
    Nov 27, 2012
    Posts:
    20
    Hi Prime 31,
    Thanks for making this plugin.
    I had this up a running for quite some time ago, but lately its been throwing me errors. The plugin is up to date.

    I've been trying to convert the Facebook.instance.getFriends 'result' object to a either IDictionary, Dictionary or Hastable.. as I'm just trying to get the friends IDs into a separate string.

    This script was working but now I'm getting errors.
    Code (csharp):
    1.  
    2. public static void GetFriends(string error,object result)
    3. {
    4.             Prime31.Utils.logObject( result );
    5.             IDictionary dict = result as IDictionary;
    6.             IList list = dict ["data"] as IList;
    7.             string rawIDs = "";
    8.             for (int i = 0; i < list.Count; i++) {
    9.                     IDictionary dict2 = list [i] as IDictionary;
    10.                     rawIDs += (dict2 ["id"] as string) + "', '";
    11.             }
    12.             friendIDs = rawIDs;
    13.             Debug.Log ("Friend IDs: " + rawIDs);
    14. }
    15.  
    the log from Prime31.Utils.logObject( result ); works fine, displaying all the "data","name","id" etc.
    {
    "data": [
    {
    "name": "Jimmy Jones",
    "id": "423523623"
    },
    {
    "name": "Kermit",
    "id": "3253245233"
    },

    I keep getting this error..
    NullReferenceException: A null value was found where an object instance was required.
    on this line ..
    Code (csharp):
    1. IDictionary dict = result as IDictionary;
    i have tried replacing it with..

    Code (csharp):
    1. var dict = result as Dictionary<string,object>;
    and this..

    Code (csharp):
    1. Hashtable ht = result as Hashtable;
    no luck with any of these.

    Thanks for your time. Any help would be most appreciated.
    Cheers.
     
    Last edited: Mar 8, 2014
  44. prime31

    prime31

    Joined:
    Oct 9, 2008
    Posts:
    6,426
    @empu, you can't just randomly cast objects to whatever you want. Here is the method signature for the getFriends method:



    The completionHandler is of type Action<string,FacebookFriendsResult>. Your code needs to match that type
     
  45. Anonymous3

    Anonymous3

    Joined:
    Jun 5, 2013
    Posts:
    7
    Hi,

    I am running the Test Scene after setting up Info.plist.
    The moment I start the app, I get the following message

    the object that is being serialized [{
    appid = <appid>;
    resource = "prime31_socialnetworking";
    version = "1.0.0";
    }] is not a valid JSON object

    After I click on the Init Button in Test Scene and try to login, I am getting a crash with the below log:

    Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[__NSCFDictionary setObject:forKey:]: attempt to insert nil value (key: body)'
    *** Call stack at first throw:
    (
    0 CoreFoundation 0x3317c64f __exceptionPreprocess + 114
    1 libobjc.A.dylib 0x35b54c5d objc_exception_throw + 24
    2 CoreFoundation 0x3317c491 +[NSException raise:format:arguments:] + 68
    3 CoreFoundation 0x3317c4cb +[NSException raise:format:] + 34
    4 CoreFoundation 0x330ee9d7 -[__NSCFDictionary setObject:forKey:] + 190
    5 TestApp 0x01111c05 -[FBRequestConnection parseJSONResponse:error:statusCode:] + 548
    6 TestApp 0x0111151d -[FBRequestConnection completeWithResponse:data:eek:rError:] + 1100
    7 TestApp 0x0110da8d __68-[FBRequestConnection startWithCacheIdentity:skipRoundtripIfCached:]_block_invoke + 312
    8 TestApp 0x01116f1f -[FBURLConnection invokeHandler:error:response:responseData:] + 82
    9 TestApp 0x01116d91 -[FBURLConnection logAndInvokeHandler:response:responseData:] + 644
    10 TestApp 0x01117779 -[FBURLConnection connectionDidFinishLoading:] + 456
    11 Foundation 0x359672f5 -[NSURLConnection(NSURLConnectionReallyInternal) sendDidFinishLoading] + 68
    12 Foundation 0x35967277 _NSURLConnectionDidFinishLoading + 78
    13 CFNetwork 0x31bee411 _ZN19URLConnectionClient23_clientDidFinishLoadingEPNS_26ClientConnectionEventQueueE + 136
    14 CFNetwork 0x31be2f45 _ZN19URLConnectionClient26ClientConnectionEventQueue33processAllEventsAndConsumePayloadEP20XConnectionEventInfoI12XClientEvent18XClientEventParamsEl + 100
    15 CFNetwork 0x31be30cd _ZN19URLConnectionClient26ClientConnectionEventQueue33processAllEventsAndConsumePayloadEP20XConnectionEventInfoI12XClientEvent18XClientEventParamsEl + 492
    16 CFNetwork 0x31be30cd _ZN19URLConnectionClient26ClientConnectionEventQueue33processAllEventsAndConsumePayloadEP20XConnectionEventInfoI12XClientEvent18XClientEventParamsEl + 492
    17 CFNetwork 0x31be2e37 _ZN19URLConnectionClient13processEventsEv + 70
    18 CFNetwork 0x31be2de9 _ZN13URLConnection24multiplexerClientPerformEP18RunLoopMultiplexer + 36
    19 CFNetwork 0x31be2d5b _ZN17MultiplexerSource7performEv + 126
    20 CFNetwork 0x31be2cd9 _ZN17MultiplexerSource8_performEPv + 8
    21 CoreFoundation 0x33153a79 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 12
    22 CoreFoundation 0x3315575f __CFRunLoopDoSources0 + 382
    23 CoreFoundation 0x331564eb __CFRunLoopRun + 230
    24 CoreFoundation 0x330e6ec3 CFRunLoopRunSpecific + 230
    25 CoreFoundation 0x330e6dcb CFRunLoopRunInMode + 58
    26 GraphicsServices 0x35fb141f GSEventRunModal + 114
    27 GraphicsServices 0x35fb14cb GSEventRun + 62
    28 UIKit 0x32d03d69 -[UIApplication _run] + 404
    29 UIKit 0x32d01807 UIApplicationMain + 670
    30 TestApp 0x0000331c main + 288
    31 TestApp 0x000031f8 start + 40
    )
    terminate called after throwing an instance of 'NSException'

    Any Help?
     
  46. anupamappar

    anupamappar

    Joined:
    Jul 15, 2013
    Posts:
    2

    I am doing the same thing as @iretro for app requests but the dialog just shows loading and it disappears, i checked the log and it shows dialogFailed event . The exact log is -

    "03-10 18:30:52.246: I/Unity(2724): dialogFailedEvent: [P31Error]: "
    and the error shows nothing
     
  47. prime31

    prime31

    Joined:
    Oct 9, 2008
    Posts:
    6,426
    @anonymous, let's start with the basics. Do you have the latest version of the plugin? Have you setup your bundle ID and ensure it matches in both Facebooks web portal and your Info.plist?
     
  48. anupamappar

    anupamappar

    Joined:
    Jul 15, 2013
    Posts:
    2
    Hey got it, its working fine now, the webview url was wrong since i was initializing the dictionary variable wrongly
     
  49. MikeCoderMore

    MikeCoderMore

    Joined:
    Sep 22, 2013
    Posts:
    61
    when posting to the wall how do i find out if it was posted successfully or if it failed, I'm using the post image like in the iOS demo
     
  50. prime31

    prime31

    Joined:
    Oct 9, 2008
    Posts:
    6,426
    @mocho, the last parameter of the postImage method is a completionHandler that returns all the data from Facebooks Graph API.