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

    cyberkada

    Joined:
    Sep 28, 2009
    Posts:
    15
    got it working, but is there a way to combine
    FacebookBinding.loginWithRequestedPermissions( fb_readPermissions );
    and
    FacebookBinding.reauthorizeWithPublishPermissions( fb_publishPermissions, FacebookSessionDefaultAudience.OnlyMe );

    in one event consecutively ? When I do it fails more often then not...
     
    Last edited: Oct 22, 2012
  2. cyberkada

    cyberkada

    Joined:
    Sep 28, 2009
    Posts:
    15
    same last issue. I want to check for the sucess/failure of the facebookReauthorizationWithPublishPermissionsSucceededEvent.
     
  3. prime31

    prime31

    Joined:
    Oct 9, 2008
    Posts:
    6,426
    @cyber, please read the documentation! We made a giant header in there to draw your attention to Facebook's new rules for authentication:
     
  4. creat327

    creat327

    Joined:
    Mar 19, 2009
    Posts:
    1,740
    Hi there,

    We noticed that now on iOS, the facebook dialog is a bit messed up for invites. We get a dialog with a list of friends to select, so we begin selecting them, they are added into the invitation list but:
    1) They are not removed from the dialog page or marked in any way, so unless you scroll to the beginning you don't know whether it was added.
    2) There is no paging. So if you have 1000 friends, there is no way for you to go through looking for a few friends unless you know their exact names and search for them particularly (not good if you want to send a few dozen invites and they are not on your first page). Is there a way to have paging on this thing?
     
  5. prime31

    prime31

    Joined:
    Oct 9, 2008
    Posts:
    6,426
    @creat, dialogs are just embedded web pages run off of Facebooks servers. Any issues with them need to be taken up with Facebook.
     
  6. cyberkada

    cyberkada

    Joined:
    Sep 28, 2009
    Posts:
    15
    I know... It works that way separately ... but its potentially annoying to players as the game seems to restart twice.

    Maybe Apple's way of forcing everyone to an iOS 6 device.
     
  7. prime31

    prime31

    Joined:
    Oct 9, 2008
    Posts:
    6,426
    @cyber, we now include the old, deprecated login system which you are free to use at your own risk. We don't recommend using it but it is there.
     
  8. Peter Gartside

    Peter Gartside

    Joined:
    Oct 23, 2012
    Posts:
    9
    Hi Prime is it possible to get the Facebook login screen to appear in an Etcetera web view window rather than it going out to safari ?
     
  9. Majkell

    Majkell

    Joined:
    Jul 17, 2012
    Posts:
    3
    I have problem with posting images with Facebook.instance.postImage( bytes, "Pasela", completionHandler ); to facebook after last update.

    Log:
    2012-10-23 15:44:32.180 pasela[3259:907] Facebook session automatically started
    Successfully logged in to Facebook

    (Filename: /Applications/buildAgent/work/14194e8ce88cdf47/Runtime/ExportGenerated/iPhonePlayer-armv7/UnityEngineDebug.cpp Line: 43)

    error: message: An active access token must be used to query information about the current user.
    type: OAuthException
    code: 2500

    I can post statuses and even image with a facebook composer on ios6, but this does'n work for me.

    EDIT: I've tried demo scene, doesn't work there either
     
  10. Xyra

    Xyra

    Joined:
    Jul 18, 2012
    Posts:
    17
    Hi,

    I'm having problems with the SocialNetworking plugin. I've just updated to the latest version in an app which was previously using a very old and out of date version and have updated all the code to the new facilities and it is logging in and posting messages fine, however I can't post images.

    I've tried deleting and reinstalling all the prime31 plugins in the app (not just social networking) but still can't get it working. I'm sure I'm missing something here!

    I've tried a completely blank project and using the example scene I'm having the exact same issue. I've spent the last few hours on this and I'm rather pulling my hair out - are there any particular places I should be looking? I've tried pulling the app token as well as the user token, I've tried setting Facebook.instance.accessToken directly and a few other things, but I'm still getting:

    error: message: An active access token must be used to query information about the current user.
    type: OAuthException
    code: 2500

    As I say everything else that I've tried seems to work fine, I just can't get this working. Any ideas would be much appreciated.

    EDIT: I see Majkell beat me to it - sorry for posting effectively the same thing again
     
    Last edited: Oct 23, 2012
  11. prime31

    prime31

    Joined:
    Oct 9, 2008
    Posts:
    6,426
    @pete, in-app logins were deprecated by Facebook well over a year ago.


    @majkell and @xyra, did you request the proper permission to post an image on behalf of the user? Any type of "publishing" request that you ask for specific permissions to do so with Facebook.
     
  12. Majkell

    Majkell

    Joined:
    Jul 17, 2012
    Posts:
    3
    I've tried that too in demo scene which comes with the plugin.

    Before I was using it with just this permissions:
    FacebookAccess.loginWithRequestedReadPermissions( new string[] { "email", "user_games_activity" }, "XXXXXXXXXXXX" );
    And it was working correctly...
     
  13. Xyra

    Xyra

    Joined:
    Jul 18, 2012
    Posts:
    17
    I believe I'm requesting the correct permissions;

    FacebookBinding.getSessionPermissions(); returns the following:
    user_games_activity, video_upload, share_item, publish_stream, installed, status_update, email, create_note, photo_upload, publish_actions
     
  14. RedVonix

    RedVonix

    Joined:
    Dec 13, 2011
    Posts:
    414
    I'm afraid I'm still having issues with reauthorizing for publish permissions. I've done a lot of tests and I just can't seem to find the problem.

    Here is how I am calling it:

    Code (csharp):
    1.  
    2. var permissions = new string[]{ "publish_actions", "user_games_activity" };
    3. FacebookBinding.reauthorizeWithPublishPermissions(permissions,FacebookSessionDefaultAudience.Everyone);
    4.  
    After that, the game always crashes. I was told before this is just a message from the Facebook SDK, however I can't get past the game crashes, and I'm not sure where to go from here. The crash I get occurs regardless of if I have any event listeners for facebookReauthorizationWithPublishPermissionsSucceededEvent or not. Here is what I see in the log:

    Code (csharp):
    1.  
    2. facebookReauthorizationWithPublishPermissionsSucceededEvent
    3. UnityEngine.Debug:Internal_Log(Int32, String, Object)
    4. UnityEngine.Debug:Log(Object)
    5. FacebookEventListener:facebookReauthorizationWithPublishPermissionsSucceededEvent() (at /Users/DCalabrese/Desktop/Projects/tumblecaps/trunk/Tcaps2/Assets/Plugins/SocialNetworking/FacebookCommon/FacebookEventListener.cs:149)
    6. FacebookManager:facebookReauthorizationWithPublishPermissionsSucceeded(String) (at /Users/DCalabrese/Desktop/Projects/tumblecaps/trunk/Tcaps2/Assets/Plugins/SocialNetworking/FacebookCommon/FacebookManager.cs:200)
    7.  
    8. (Filename: /Users/DCalabrese/Desktop/Projects/tumblecaps/trunk/Tcaps2/Assets/Plugins/SocialNetworking/FacebookCommon/FacebookEventListener.cs Line: 149)
    9.  
    10. 2012-10-23 11:43:50.285 tcapsretro[836:907] An instance 0xe8bd690 of class FBSessionManualTokenCachingStrategy was deallocated while key value observers were still registered with it. Observation info was leaked, and may even become mistakenly attached to some other object. Set a breakpoint on NSKVODeallocateBreak to stop here in the debugger. Here's the current observation info:
    11. <NSKeyValueObservationInfo 0x2deefa0> (
    12. <NSKeyValueObservance 0x2d5ec20: Observer: 0xe8c2fc0, Key path: accessToken, Options: <New: NO, Old: NO, Prior: YES> Context: 0x1596834, Property: 0xf025d20>
    13. <NSKeyValueObservance 0x12a598d0: Observer: 0xe8c2fc0, Key path: expirationDate, Options: <New: NO, Old: NO, Prior: YES> Context: 0x1596834, Property: 0x12aadb00>
    14. )
    15.  
    Currently, I am completely stumped and could really use a pointer in the direction needed to get the game to continue on after it receives the authorization.

    Thank you!
     
  15. prime31

    prime31

    Joined:
    Oct 9, 2008
    Posts:
    6,426
    @dcalabrese, please provide a proper back trace. You may also want to send it to Facebook because the crash is almost certainly coming from their SDK.
     
  16. RedVonix

    RedVonix

    Joined:
    Dec 13, 2011
    Posts:
    414
    Prime,

    I actually just noticed this as well in the logs. I may be doing something wrong in my login setup. This is from when I send off the reauthorization for publish permissions request:
    Code (csharp):
    1.  
    2. 2012-10-23 11:43:50.213 tcapsretro[836:907] FBConditionalLog: FBSession: a permission request for publish or manage permissions contains unexpected read permissions
    3. Successfully logged in to Facebook
    4. UnityEngine.Debug:Internal_Log(Int32, String, Object)
    5. UnityEngine.Debug:Log(Object)
    6. FacebookEventListener:facebookLogin() (at /Users/DCalabrese/Desktop/Projects/tumblecaps/trunk/Tcaps2/Assets/Plugins/SocialNetworking/FacebookCommon/FacebookEventListener.cs:59)
    7. System.Action:invoke_void__this__()
    8. FacebookManager:facebookLoginSucceeded(String) (at /Users/DCalabrese/Desktop/Projects/tumblecaps/trunk/Tcaps2/Assets/Plugins/SocialNetworking/FacebookCommon/FacebookManager.cs:80)
    9.  
    It almost sounds like it's puking because it doesn't like the existing read conditions, though it's still finishing the full chain - but it's then crashing because the SDK receive a publish permissions response but had incorrect read permissions. So, let me verify my chain of actions here.

    This is the order I am doing things.

    1.) Initalize Facebook
    Code (csharp):
    1. FacebookBinding.init("XXXXXXX");
    2.) Login to Facebook
    Code (csharp):
    1.  
    2. var permissions = new string[] { "email" };
    3. FacebookBinding.loginWithRequestedPermissions( permissions );
    4.  
    3.) Request reauthorization with publish permissions.
    Code (csharp):
    1.  
    2. var permissions = new string[]{ "publish_actions", "user_games_activity" };
    3. FacebookBinding.reauthorizeWithPublishPermissions(permissions,FacebookSessionDefaultAudience.Everyone);
    4.  
    Does that order look correct to you? Am I missing anything? I was not reauthorizing with read permissions as it was my understanding that basic read permissions are already present in the initial login, and the only data I am acquiring is the user's ID and first name.
     
  17. prime31

    prime31

    Joined:
    Oct 9, 2008
    Posts:
    6,426
    @D, that error is crystal clear: "FBSession: a permission request for publish or manage permissions contains unexpected read permissions" You cannot just mix and match your permission requests with the new way Facebook does things. When you call reauthorizeWithPublishPermissions it must be with only publish permissions. Facebooks SDK will crash your app if you don't follow the rules.
     
  18. RedVonix

    RedVonix

    Joined:
    Dec 13, 2011
    Posts:
    414
    Ok. That makes sense! Thank you for explaining that.

    So with that, I changed my authorization request to this:
    Code (csharp):
    1.  
    2. var permissions = new string[]{ "publish_actions" };
    3. FacebookBinding.reauthorizeWithPublishPermissions(permissions,FacebookSessionDefaultAudience.Everyone);
    4.  
    However, my crash error is now:
    Code (csharp):
    1.  
    2. facebookReauthorizationWithPublishPermissionsSucceededEvent
    3. UnityEngine.Debug:Internal_Log(Int32, String, Object)
    4. UnityEngine.Debug:Log(Object)
    5. FacebookEventListener:facebookReauthorizationWithPublishPermissionsSucceededEvent() (at /Users/DCalabrese/Desktop/Projects/tumblecaps/trunk/Tcaps2/Assets/Plugins/SocialNetworking/FacebookCommon/FacebookEventListener.cs:149)
    6. FacebookManager:facebookReauthorizationWithPublishPermissionsSucceeded(String) (at /Users/DCalabrese/Desktop/Projects/tumblecaps/trunk/Tcaps2/Assets/Plugins/SocialNetworking/FacebookCommon/FacebookManager.cs:200)
    7.  
    8. (Filename: /Users/DCalabrese/Desktop/Projects/tumblecaps/trunk/Tcaps2/Assets/Plugins/SocialNetworking/FacebookCommon/FacebookEventListener.cs Line: 149)
    9.  
    10. 2012-10-23 12:38:56.450 tcapsretro[948:907] An instance 0x3b659a0 of class FBSessionManualTokenCachingStrategy was deallocated while key value observers were still registered with it. Observation info was leaked, and may even become mistakenly attached to some other object. Set a breakpoint on NSKVODeallocateBreak to stop here in the debugger. Here's the current observation info:
    11. <NSKeyValueObservationInfo 0x3b15960> (
    12. <NSKeyValueObservance 0xe9fa750: Observer: 0xf8cce20, Key path: accessToken, Options: <New: NO, Old: NO, Prior: YES> Context: 0x1596834, Property: 0xf8d0150>
    13. <NSKeyValueObservance 0x3b15920: Observer: 0xf8cce20, Key path: expirationDate, Options: <New: NO, Old: NO, Prior: YES> Context: 0x1596834, Property: 0xf889160>
    14. )
    15.  
    In addition, I see I ALSO have an error just after login occurs, which looks like this:
    Code (csharp):
    1.  
    2. Successfully logged in to Facebook
    3. UnityEngine.Debug:Internal_Log(Int32, String, Object)
    4. UnityEngine.Debug:Log(Object)
    5. FacebookEventListener:facebookLogin() (at /Users/DCalabrese/Desktop/Projects/tumblecaps/trunk/Tcaps2/Assets/Plugins/SocialNetworking/FacebookCommon/FacebookEventListener.cs:59)
    6. System.Action:invoke_void__this__()
    7. FacebookManager:facebookLoginSucceeded(String) (at /Users/DCalabrese/Desktop/Projects/tumblecaps/trunk/Tcaps2/Assets/Plugins/SocialNetworking/FacebookCommon/FacebookManager.cs:80)
    8.  
    9. (Filename: /Users/DCalabrese/Desktop/Projects/tumblecaps/trunk/Tcaps2/Assets/Plugins/SocialNetworking/FacebookCommon/FacebookEventListener.cs Line: 59)
    10.  
    11. 2012-10-23 12:38:56.142 tcapsretro[948:907] An instance 0xe973e00 of class FBSessionManualTokenCachingStrategy was deallocated while key value observers were still registered with it. Observation info was leaked, and may even become mistakenly attached to some other object. Set a breakpoint on NSKVODeallocateBreak to stop here in the debugger. Here's the current observation info:
    12. <NSKeyValueObservationInfo 0x3b9b860> (
    13. <NSKeyValueObservance 0x3b2bfd0: Observer: 0xf8c2620, Key path: accessToken, Options: <New: NO, Old: NO, Prior: YES> Context: 0x1596834, Property: 0xf8d0150>
    14. <NSKeyValueObservance 0xf88d730: Observer: 0xf8c2620, Key path: expirationDate, Options: <New: NO, Old: NO, Prior: YES> Context: 0x1596834, Property: 0xf889160>
    15. )
    16. Facebook - Login Completed.
    17. UnityEngine.Debug:Internal_Log(Int32, String, Object)
    18. UnityEngine.Debug:Log(Object)
    19. UIManager:facebookLoginFinished() (at /Users/DCalabrese/Desktop/Projects/tumblecaps/trunk/Tcaps2/Assets/Scripts/UI/UIManager.cs:880)
    20. System.Action:invoke_void__this__()
    21. FacebookManager:facebookLoginSucceeded(String) (at /Users/DCalabrese/Desktop/Projects/tumblecaps/trunk/Tcaps2/Assets/Plugins/SocialNetworking/FacebookCommon/FacebookManager.cs:80)
    22.  
    So there I may have something wrong with my login code, as the SDK is also spitting out an error just after login? That again looks like this:
    Code (csharp):
    1.  
    2. // Init Facebook
    3. FacebookBinding.init("XXXXXXXXXXXX");
    4.                
    5. // Login the user
    6. var permissions = new string[] { "email" };
    7. FacebookBinding.loginWithRequestedPermissions( permissions );
    8.  
    Facebook really has created a mess with their new rules, haven't they. :) I've read a ton of people complaining about problems over various forums and in discussions trying to get this to work, pretty much all related to the Facebook updates.
     
  19. Xyra

    Xyra

    Joined:
    Jul 18, 2012
    Posts:
    17
    Did you have any more luck with getting this working?
     
  20. RedVonix

    RedVonix

    Joined:
    Dec 13, 2011
    Posts:
    414
    Login with ONLY email. Remove the 'user_games_activity'. Try that.
     
  21. njmurarka

    njmurarka

    Joined:
    Sep 20, 2012
    Posts:
    1
    Hi people.

    So I am new to using the Prime31 plugin. I installed it and wanted to be able to have two buttons... one to login to FB, and one to logout.

    It seems that the first time I used the plugin, I got a proper FB login form and all went fine. When I try to logout in Unity3D, it is still "fine" as in there is no crash. But when I try to login now, what happens after there is a "switch" from my U3D app to the FB login popup is that the popup comes up for a second but it is not complete and then I get dumped back at the U3D app with the following error in the log on XCODE:



    It is happening consistently now. I can issue a logout, but a login keeps failing with the above.

    I login with:

    var permissions = new string[] { "email", "user_games_activity" };

    FacebookBinding.loginWithRequestedReadPermissions(permissions);

    I logout with:

    FacebookBinding.logout();
     
  22. galgantur

    galgantur

    Joined:
    Nov 30, 2009
    Posts:
    5
    Got similar problem here:
    actually I have added these listeners:
    Code (csharp):
    1.  
    2. FacebookManager.facebookReauthorizationWithPublishPermissionsSucceededEvent += OnReauthorizeSuccess;
    3. FacebookManager.facebookReauthorizationWithPublishPermissionsFailedEvent += OnReauthorizeFailed;
    4. FacebookManager.loginSucceededEvent += OnEventFacebookLogin;
    5.  
    I'll post the current code:
    Code (csharp):
    1.  
    2. #if UNITY_ANDROID
    3. using FacebookAccess = FacebookAndroid;
    4. #elif UNITY_IPHONE
    5. using FacebookAccess = FacebookBinding;
    6. #endif
    7.  
    8. public void SaveScore(string i_Level,string i_Score)
    9.     {
    10. #if UNITY_IPHONE
    11.         FacebookManager.customRequestReceivedEvent += result =>
    12.         {
    13.             ResultLogger.logObject( result );
    14.         };
    15.         Facebook.instance.debugRequests = true;//debug
    16. #endif
    17.         m_Level = i_Level;
    18.         m_Score = i_Score;
    19.         //check if the app is reachable
    20.         FacebookAccess.init( APP_ID );
    21.         FacebookManager.facebookReauthorizationWithPublishPermissionsSucceededEvent += OnReauthorizeSuccess;
    22.         FacebookManager.facebookReauthorizationWithPublishPermissionsFailedEvent += OnReauthorizeFailed;
    23.         FacebookManager.loginSucceededEvent += OnEventFacebookLogin;
    24.        
    25.         if (!FacebookAccess.isSessionValid())
    26.         {
    27.             //login to FB
    28. #if ANDROID_UNITY
    29.             FacebookAccess.loginWithRequestedPermissions( new string[] { "publish_stream, email"});
    30. #elif UNITY_IPHONE
    31.             var permissions = new string[] { "email"};
    32.             FacebookAccess.loginWithRequestedReadPermissions( permissions );
    33. #endif
    34.         }
    35.         else
    36.         {
    37.             //login to FB
    38.             OnEventFacebookLogin();
    39.         }
    40.     }
    41.    
    42.     private void OnEventFacebookLogin()
    43.     {
    44.        
    45. #if ANDROID_UNITY
    46.         Debug.Log("ANDROID_UNITY - OnEventFacebookLogin");
    47.         Facebook.instance.graphRequest( "me", CompletionHandler );
    48. #elif UNITY_IPHONE
    49.         Debug.Log("UNITY_IPHONE - OnEventFacebookLogin");
    50.         var permissions = new string[] { "publish_actions" };
    51.         FacebookAccess.reauthorizeWithPublishPermissions( permissions, FacebookSessionDefaultAudience.Friends  );
    52. #endif
    53.        
    54.     }
    55.    
    56.     private void OnReauthorizeSuccess()
    57.     {
    58.         Debug.Log("OnReauthorizeEvent");
    59.         Facebook.instance.graphRequest( "me", CompletionHandler );
    60.     }
    61.    
    62.     private void OnReauthorizeFailed(string error)
    63.     {
    64.         Debug.Log("OnReauthorizeFailed "+error);
    65.        
    66.     }
    67.  
    68.    
    69.     private void CompletionHandler( string i_Error, object i_Result )
    70.     {
    71.         Debug.Log("CompletionHandler");
    72.         if( i_Error != null )
    73.             Debug.LogError( i_Error );
    74.         else
    75.         {
    76.             m_UserId = "";
    77.  
    78.             if( i_Result.GetType() == typeof( ArrayList ) )
    79.             {
    80.                 m_UserId =((ArrayList)i_Result)[0].ToString();
    81.             }
    82.             else if( i_Result.GetType() == typeof( Hashtable ) )
    83.             {
    84.                 m_UserId =((Hashtable)i_Result)["id"].ToString();
    85.             }
    86.             else
    87.             {
    88.                 m_UserId = "0";
    89.             }
    90.            
    91.            
    92.             string facebookMessageLink      = HTTP_LINK;
    93.             string facebookMessageName      = "LeaderBoard" ;
    94.             string facebookMessagePicLink   = PIC ;
    95.             string facebookMessageCaption   = "My Score For Level "+m_Level+": "+m_Score;
    96.            
    97.        
    98. #if UNITY_ANDROID
    99.                 FacebookAccess.showPostMessageDialogWithOptions (
    100.                 facebookMessageLink,
    101.                 facebookMessageName,
    102.                 facebookMessagePicLink,
    103.                 facebookMessageCaption
    104.                 );
    105. #elif UNITY_IPHONE
    106.                 var parameters = new Dictionary<string,string>
    107.                 {
    108.                     { "link", facebookMessageLink },
    109.                     { "name", facebookMessageName },
    110.                     { "picture", facebookMessagePicLink },
    111.                     { "caption", facebookMessageCaption }
    112.                 };
    113.                 Debug.Log(parameters.toJson());
    114.                 FacebookAccess.showDialog( "stream.publish", parameters );
    115. #endif
    116.            
    117.            
    118.             SaveScoreOnDb();
    119.             FacebookManager.facebookReauthorizationWithPublishPermissionsSucceededEvent -= OnReauthorizeSuccess;
    120.             FacebookManager.facebookReauthorizationWithPublishPermissionsFailedEvent -= OnReauthorizeFailed;
    121.             FacebookManager.loginSucceededEvent -= OnEventFacebookLogin;
    122.         }
    123.  
    124.     }
    125.    
    126.  
    The code flow is quite simple:
    1. FacebookAccess.init( APP_ID );
    2. FacebookAccess.loginWithRequestedReadPermissions( permissions );
    3. FacebookAccess.reauthorizeWithPublishPermissions( permissions, FacebookSessionDefaultAudience.Friends );
    4. Facebook.instance.graphRequest( "me", CompletionHandler );
    5. FacebookAccess.showDialog( "stream.publish", parameters );

    This code is ANDROID/IPHONE compatible: it works fine on Android device, but it gives errors on iPhone.
    Is that a bug or I missed something?

    Ps. Info.Plist has been modified correctly
     
  23. prime31

    prime31

    Joined:
    Oct 9, 2008
    Posts:
    6,426
    @njmurarka, that log is normal and is coming from the FB SDK. We have already opened a bug report with them and you can feel free to do the same. Using the demo scene we cannot replicate login not working. The events fire as expected. I would recommend that you use the demo scene to test and watch the log which will dump all events so that you can learn how it all works.


    @galgantur, make sure you import the iOS plugin last. Facebook has not updated the Android SDK so the iOS version of the *Manager script has some extra events for the time being.
     
  24. galgantur

    galgantur

    Joined:
    Nov 30, 2009
    Posts:
    5
    @prime31: do you mean to use the last plugin version? I think i'm using the last available version in the store.
    The deprecated method works fine.
     
  25. prime31

    prime31

    Joined:
    Oct 9, 2008
    Posts:
    6,426
    @galgantur, delete the FacebookManager file and reimport to ensure you have the latest version of the file which absolutely has a facebookReauthorizationWithPublishPermissionsSucceeded method
     
  26. Amitloaf

    Amitloaf

    Joined:
    Jan 30, 2012
    Posts:
    94
    After updating my social network plugin to the latest revision the game crashes on all devices that didn't have my game installed before or deleted it and reinstalled.
    On XCode I can see that It dies in applicationDidBecomeActive in FacebookManager.m in FBSession.activeSession handleDidBecomeActive.
    I can also see in the thread stack trace that it got to [FBSession initWithAppID:permissions:defaultAudience:urlSchemeSuffix:tokenCacheStrategy:]
    and then got [NSException raise]
    Tried deleting all prime31 plugins I use with all the files and just import the newest (26-10) version of SocialNetwork for iOS. Still the same. Any ideas?
     
  27. prime31

    prime31

    Joined:
    Oct 9, 2008
    Posts:
    6,426
    @amit, what is the Exception? You said that it is raised but failed to say what it is. Our code does not use exceptions so the content of that is how you can see what the issue is. A proper backtrace would also be useful for debugging.
     
  28. Amitloaf

    Amitloaf

    Joined:
    Jan 30, 2012
    Posts:
    94
    Ok i did some checks and found what the problem was. Apparently I should've entered the app id in the Info.plist additions... under Facebook App ID. I didn't see that in the documentation.
    Thanks for the help
     
  29. Vaklav

    Vaklav

    Joined:
    Sep 27, 2012
    Posts:
    6
    Thanks for making this great plugin. It saved me a ton of time! I do have one question regarding facebook composer. I can authorize and post from the device on both composer and non composer windows. However, I can't seem to be able to put an image on the facebook composer window.

    While FacebookBinding.showdialog() is able to grab a parameter "picture" and use a .png from a URL and display it properly, FacebookBinding.showFacebookComposer won't. I'm passing it a url for a png file, the very same one I give showdialog. I must be missing something, but I can't think of what. Here's that snippet of code:

    FacebookBinding.showFacebookComposer( fbtext,
    "http://exampleURL.com/GameLogo.png",
    "http://linktothegamepage.com" );

    Thanks for your hard work!
     
  30. prime31

    prime31

    Joined:
    Oct 9, 2008
    Posts:
    6,426
    @vaklav, the dialog requires a web accessible image while the composer requires a locally available image file that is on the device.
     
  31. Vaklav

    Vaklav

    Joined:
    Sep 27, 2012
    Posts:
    6
    Ahh, I was afraid that might be the case. Ok then. Is there any way to get rid of the safari torn paper that appears on composer when I pass it a null path to an image?
    Thanks a ton again for your fast response.
     
  32. prime31

    prime31

    Joined:
    Oct 9, 2008
    Posts:
    6,426
    @vaklav, not without using private APIs and mangling the views that iOS creates.
     
  33. Texaggie96

    Texaggie96

    Joined:
    Jan 23, 2009
    Posts:
    81
    I am getting this crash due to Facebook.

    "Terminating app due to uncaught exception 'com.facebook.sdk:InvalidOperationException', reason: 'FBSession: No AppID provided; either pass an AppID to init, or add a string valued key with the appropriate id named FacebookAppID to the bundle *.plist'"

    I don't really understand this. I have added the URLScheme "fb<yourFBappID>" to the plist as suggested on Prime's SocialNetworking Documentation. Also my call to FacebookBinding.init() has our FBappID in it. Checking the info.plist in the xcode project shows the correct URLScheme above. Any solutions?

    Edit: This was working on an older version of SocialNetworking. I completely deleted the plugin in both Plugins and Editor and re-installed the latest one.
     
  34. prime31

    prime31

    Joined:
    Oct 9, 2008
    Posts:
    6,426
    @tex, did you add your Facebook app ID to the new Info.plist field with the aptly named label "FacebookAppID"?
     
  35. Texaggie96

    Texaggie96

    Joined:
    Jan 23, 2009
    Posts:
    81
    That gets past the crash. I would suggest an update to the Social Networking Documentation for those of us upgrading from older versions. Bonus points for being able to update the xcode plist scriptically so that it makes it easier to do multi-platform development.
     
  36. prime31

    prime31

    Joined:
    Oct 9, 2008
    Posts:
    6,426
    @Texaggie, use the included Plist Editor from the prime[31] menu.
     
  37. Texaggie96

    Texaggie96

    Joined:
    Jan 23, 2009
    Posts:
    81
    How would you do this? My Plist editor in the prime31 menu ("info.plist additions") just allows me to add URL Scheme and Background Modes. I need to add "FacebookAppID" as its own string key to plist. Moreover, is there a way to scriptically do it? Is there an api to do this scriptically in the P31MenuItem.DLL?
     
  38. prime31

    prime31

    Joined:
    Oct 9, 2008
    Posts:
    6,426
    @tex, update your menu item to get the latest version which now has the FacebookAppID.
     
  39. serioustommy

    serioustommy

    Joined:
    Jun 12, 2012
    Posts:
    126
    by the way Prime with the new version of the facebook plugin I'm having the same issue as Tex - passing in the facebook id through init crashes with the same error message. The only way to fix it is to put the facebook id in the Plist editor. Not a big deal but since the error message says "either pass an AppID to init" it does seem like a bug.
     
  40. prime31

    prime31

    Joined:
    Oct 9, 2008
    Posts:
    6,426
    @serious, from the docs:

    We have no control over Facebooks error messages so there is no way we can clarify that. You just have to follow the docs.
     
    Last edited: Oct 31, 2012
  41. serioustommy

    serioustommy

    Joined:
    Jun 12, 2012
    Posts:
    126
    ok I'm cool with that :)
     
  42. Texaggie96

    Texaggie96

    Joined:
    Jan 23, 2009
    Posts:
    81
    Just an FYI. "reauthorizeWithPublishPermissions" triggers the loginSucceededEvent event as well as the facebookReauthorizationWithPublishPermissionsSucceededEvent. This can if lead to continual reauthorizeWithPublishPermissions if facebookReauthorizationWithPublishPermissionsSucceededEvent is in your loginSucceededEvent listener. You will see it for a brief second bring up the dialog and go back to the window for reauthorization. To prevent this you need to unregister your loginSucceededEvent listeners inside. Just an FYI for those working on this.
     
  43. prime31

    prime31

    Joined:
    Oct 9, 2008
    Posts:
    6,426
    @texaggie, that is by design. A reauthorization is also a login per the Facebook SDK.
     
  44. darkmax

    darkmax

    Joined:
    Feb 21, 2012
    Posts:
    83
    i download the last version of the plugin for ios, and i having a problem with twitter that is what i'm using right now, first i call init with the keys, and then i check if user is logged in, and then if true show composer but if false i use showOauthLoginDialog() and show the dialog to authorize i use my account of twitter to authorize and then it show a ok dialog and the resumes to my application and tried to catch the event if succesful show composer, but nothing happens, but if i login on settings with my account now i can tweet, so my question is how can i login with my application without enter to settings->twitter on the iphone, and also i having a little trouble to understand the events if there is a tutorial on how to use this events will be helpful.
     
  45. prime31

    prime31

    Joined:
    Oct 9, 2008
    Posts:
    6,426
    @dark, the tweet sheet has absolutely nothing to do with Oauth login. They are two entirely separate systems. The tweet sheet requires that the user logs into Twitter via the Settings.app. It will not and cannot use a login credential gained from an Oauth login. See our documentation for multiple video tutorials about events and Actions. All of our plugins also come with a *EventListener class demonstrating how to list to every available event.
     
  46. Artial

    Artial

    Joined:
    Dec 27, 2008
    Posts:
    22
    Hello,

    I can not get the iOS6 facebook native controls to work anymore - asking read permissions falls back to iOS5 fast app switching. Facebook account is well configured in the iOS6 settings, on 2 devices.

    I also can't get a fresh new unity projet along a newly created facebook app number to use iOS6 controls, only app switching. I have seen this working before. So something went wrong recently - I just can't figure out if it's a regression in the plug in (version 2012-10-26) or on my side.

    Anyone else seen this behaviour (or the opposite) ?
     
  47. angrypenguin

    angrypenguin

    Joined:
    Dec 29, 2011
    Posts:
    15,516
    So, what happens in a Facebook.instance.graphRequest(...) function in the Social Networking plugin for Android? I'm getting a java.io.FileNotFoundException, which I've seen mentioned once and it was said that Unity's WWW must be interpreting a URL as a file for some reason - but that was a while back and I'm sure people are using graph requests.

    Also, getFriends(...) works fine.
     
  48. prime31

    prime31

    Joined:
    Oct 9, 2008
    Posts:
    6,426
    @artial, ensure that you have a FB app setup in the Settings.app.


    @angrypenguin, please post Android questions in the Android forum. A FileNotFoundException often indicates you dont have the internet permission set to required in the player settings.
     
  49. Artial

    Artial

    Joined:
    Dec 27, 2008
    Posts:
    22
    You're right, my app doesn't show at all there. I ask only for read permissions (user_birthday ) with loginWithRequestedReadPermissions. Is there something else required to get the native iOS6 controls then?
     
  50. prime31

    prime31

    Joined:
    Oct 9, 2008
    Posts:
    6,426
    @artial, just the usual stuff: Facebook app setup with matching bundle ID, proper matching provisioning profile, etc.