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

    blolasss

    Joined:
    Jan 2, 2013
    Posts:
    4
    I'm using "postMessageWithLink" method.
    Does this have any effect on event handlers (In demo scene you are using "postMessage" and "postMessageWithLinkAndLinkToImage") ?
     
  2. prime31

    prime31

    Joined:
    Oct 9, 2008
    Posts:
    6,426
    @blolass, run it in the demo scene and watch the logs. Every single event that gets fired will be logged the order that they are fired.
     
  3. blolasss

    blolasss

    Joined:
    Jan 2, 2013
    Posts:
    4
    Code (csharp):
    1.  
    2. postingMessage
    3.  
    4. (Filename: /Applications/buildAgent/work/14194e8ce88cdf47/Runtime/ExportGenerated/iPhonePlayer-armv7/UnityEngineDebug.cpp Line: 43)
    5.  
    6.  --------- IDictionary ---------
    7. id: 1103482429_294924700633765
    8.  
    9.  
    10. (Filename: /Applications/buildAgent/work/14194e8ce88cdf47/Runtime/ExportGenerated/iPhonePlayer-armv7/UnityEngineDebug.cpp Line: 43)
    11.  
    This is Log from Demo Scene.
    I don't get any "dialogCompletedEvent".
     
  4. prime31

    prime31

    Joined:
    Oct 9, 2008
    Posts:
    6,426
    @blolasss, you didnt get a dialogCompletedEvent because you didnt show a dialog, you posted a message. They are two entirely different operations.
     
  5. blolasss

    blolasss

    Joined:
    Jan 2, 2013
    Posts:
    4
    So i need to display Dialog ?
    Or is there any oder way to just check when the message is posted (If i use only "postMessageWithLink")?
     
  6. rejwan1

    rejwan1

    Joined:
    Jul 3, 2012
    Posts:
    40
    Prime31 - calling this:
    Code (csharp):
    1. Dictionary<string, string> parameters = new Dictionary<string, string>();
    2.         parameters.Add("title", Title);
    3.         parameters.Add("message", Message);
    4.         parameters.Add("data", Data);
    5.         FacebookBinding.showDialog("apprequests", parameters);
    On iOS 6.1 with your newest Social plugin gives out the following error:
    Code (csharp):
    1. 2013-02-20 16:19:20.934 matchking[1632:907] -[NSNull length]: unrecognized selector sent to instance 0x3ac00090
    With this stack trace:
    Code (csharp):
    1. matchking`+[FBUtility stringByURLEncodingString:] at FBUtility.m:63:
    2. 0x1e300d4:  push   {r7, lr}
    3. 0x1e300d6:  mov    r7, sp
    4. 0x1e300d8:  sub    sp, #24
    5. 0x1e300da:  movs   r3, #0
    6. 0x1e300dc:  movt   r3, #0
    7. 0x1e300e0:  movw   r9, #63312
    8. 0x1e300e4:  movt   r9, #31
    9. 0x1e300e8:  add    r9, pc
    10. 0x1e300ea:  movw   r12, #256
    11. 0x1e300ee:  movt   r12, #2048
    12. 0x1e300f2:  movw   lr, #28870
    13. 0x1e300f6:  movt   lr, #30
    14. 0x1e300fa:  add    lr, pc
    15. 0x1e300fc:  ldr.w  lr, [lr]
    16. 0x1e30100:  str    r0, [sp, #20]
    17. 0x1e30102:  str    r1, [sp, #16]
    18. 0x1e30104:  str    r2, [sp, #12]
    19. 0x1e30106:  ldr.w  r0, [lr]
    20. 0x1e3010a:  ldr    r1, [sp, #12]
    21. 0x1e3010c:  mov    r2, r3
    22. 0x1e3010e:  mov    r3, r9
    23. 0x1e30110:  str.w  r12, [sp]
    24. 0x1e30114:  blx    0x1e51248                 ; symbol stub for: CFURLCreateStringByAddingPercentEscapes
    25. 0x1e30118:  movw   r1, #36464
    26. 0x1e3011c:  movt   r1, #31
    27. 0x1e30120:  add    r1, pc
    28. 0x1e30122:  str    r0, [sp, #8]
    29. 0x1e30124:  ldr    r0, [sp, #8]
    30. 0x1e30126:  ldr    r1, [r1]
    31. 0x1e30128:  blx    0x1e50b10                 ; symbol stub for: objc_msgSend
    32. 0x1e3012c:  ldr    r1, [sp, #8]
    33. 0x1e3012e:  str    r0, [sp, #4]
    34. 0x1e30130:  mov    r0, r1
    35. 0x1e30132:  add    sp, #24
    36. 0x1e30134:  pop    {r7, pc}
    37.  
     
  7. prime31

    prime31

    Joined:
    Oct 9, 2008
    Posts:
    6,426
    @blolasss, call the method with the demo scene and watch the logs. Every single event that fires will be logged.


    @rejwan, open a bug report with Facebook (assuming you actually are not passing null values to them). The error is coming from their SDK code.
     
  8. Grz

    Grz

    Joined:
    Feb 10, 2013
    Posts:
    5
    I've added an event handler for graphRequestCompletedEvent in one of my classes, but it seems that the event is never firing?

    I do call a /me (which is successful), as well as a few other graph calls like friends, score stuff etc.

    Do I need to do something special in order for the event to be fired? The login event is definitely working (sessionOpenedEvent).
     
  9. prime31

    prime31

    Joined:
    Oct 9, 2008
    Posts:
    6,426
    @grz, see the demo scene for a working example. Watch our videos on YouTube (prime31studios username) or use Google to find tutorials to learn how events work.
     
  10. arslanmkhan

    arslanmkhan

    Joined:
    Feb 15, 2012
    Posts:
    5
    hi i am trying to use prime31 plugin for social networking i have successfuly integrated facebook but when i tries to use twitter it gives me message "Successfully posted to Twitter" but i cant see the tweet on twitter
     
  11. prime31

    prime31

    Joined:
    Oct 9, 2008
    Posts:
    6,426
    @arslan, have you contacted Twitter? What exactly do you think we can do in this situation? The plugin can only return the information Twitter provides. You need to contact Twitter for issues with their servers and service.
     
  12. hellobard

    hellobard

    Joined:
    Sep 26, 2012
    Posts:
    139
    Hi,

    I am trying to use the Twitter Tweetsheet and it is working really great except for one thing: the Time.deltaTime shows up in the tweet like this "Check out this awesome game: http://bit.ly/12fhjshfj 0.0102424"

    I tried removing Time.timeDelta, but then the image is no longer attached in the tweet and it just shows the iPhone's internal address to the screenshot in the tweet.

    Here is the code I snipped from the example and edited to a javascript:
    #pragma strict

    // import System.Collections;
    import System.Collections.Generic;
    import System;
    import System.IO;
    import Prime31;

    public var canUseTweetSheet : boolean;

    function Start () {
    canUseTweetSheet = TwitterBinding.isTweetSheetSupported() TwitterBinding.canUserTweet();
    Application.CaptureScreenshot( FacebookGUIManager.screenshotFilename );

    }

    function Update () {

    }


    function TweetSheeter () {
    var pathToImage = Application.persistentDataPath + "/" + FacebookGUIManager.screenshotFilename;
    TwitterBinding.showTweetComposer( "Check out this awesome game: http://bit.ly/12T0uLJ" + Time.deltaTime, pathToImage );
    //TwitterBinding.showTweetComposer( "I'm posting this from Unity with a fancy image: " + Time.deltaTime, pathToImage );
    }
     
    Last edited: Feb 21, 2013
  13. prime31

    prime31

    Joined:
    Oct 9, 2008
    Posts:
    6,426
    @hello, ensure your image is vlid by using File.Exists on the full path. The plugin merely passes exactly the image data through with zero processing so if the image is not showing up you are not passing a valid image through.
     
  14. hellobard

    hellobard

    Joined:
    Sep 26, 2012
    Posts:
    139
    Thanks for the quick reply!

    Right, I'm not a very good coder unfortunately, where exactly do I add this File.Exists? And why does your example scene have this bug too?
     
  15. andymads

    andymads

    Joined:
    Jun 16, 2011
    Posts:
    1,614
    @Prime31, a suggestion: please move the event listener cs file into the demo folder, like you have done in the StoreKit and Etcetera plugins.
     
  16. prime31

    prime31

    Joined:
    Oct 9, 2008
    Posts:
    6,426
    @andy, when we make major plugin folder structure changes it takes time to propagate them to all plugins. Sit back, relax and it will eventually be the same for all plugins.
     
  17. AbyssalGames

    AbyssalGames

    Joined:
    Feb 22, 2013
    Posts:
    2
    @prime31 i have been trying to integrate the social networking plugin into my apps but i bump into problems. I am able to run the demo scene but i have no idea what to do after i click the login button. It ask me to login and then i enter my account information then switch page and it says error. I click "ok" and it return me to the demo scene but i am not logged in. Do you have any idea what can i do to fix that.
    Thanks
     
  18. prime31

    prime31

    Joined:
    Oct 9, 2008
    Posts:
    6,426
    @abyssal, if you get an error after logging in your did not properly setup your Facebook application and/or your iOS application. Refer to the documentation here: http://prime31.com/docs#iosSocial along with Facebook's docs for setting up an app.
     
  19. AbyssalGames

    AbyssalGames

    Joined:
    Feb 22, 2013
    Posts:
    2
    Thank you. The problem was that you absolutely need to use a developer facebook account to test the plugin wich we did not think of doing.
     
  20. Nub3h

    Nub3h

    Joined:
    Aug 23, 2012
    Posts:
    56
    Hi Prime31,
    I'm having an issue with the share panel (using the Social Networking plugin on Unity 4 Pro on Mac) when I run this line after the "share" button in my app is pressed:

    Code (csharp):
    1. SharingBinding.shareItems( new string[] { "test" }, new string[]{"UIActivityTypePrint", "UIActivityTypeCopyToPasteboard"});
    the share panel pops up correctly, but for starter the "Copy" icon is still there even though I asked to not show it. Second problem is that the app crashes if I press Cancel and I don't get any useful debug error in XCode except that the error happens:

    Code (csharp):
    1. 0x3b087d74:  ldr    r1, [r0], #4        BAD_EXC_ACCESS
    If instead of pressing Cancel I share on Facebook or Twitter everything works fine.

    I have the latest version of the plugin and I noticed that in the release notes it's mentioned that there's a fix for a potential error when Cancel is pressed in the share panel...but I still get an error. Any idea?

    Thank you
     
    Last edited: Feb 25, 2013
  21. prime31

    prime31

    Joined:
    Oct 9, 2008
    Posts:
    6,426
    @nub3, UIActivityTypeCopyToPasteboard is the name of the variable. You need to pass the value of that variable. It will always be in the format "com.apple.something". We cannot reproduce the issue with crashing on cancel. Delete all old plugin files and reimport to ensure you are on the latest version.
     
  22. cms

    cms

    Joined:
    Sep 19, 2011
    Posts:
    43
    Hello prime,

    I have installed the social networking plugin. Anytime I tried to "Update prime[31] tools" in the menu, I get a little window with the message:


    In the console, I get this:

    There is also a Debug.Log

    Any hints or ideas to find the problem ? Thanks in advance.
     
  23. prime31

    prime31

    Joined:
    Oct 9, 2008
    Posts:
    6,426
    @cms, you can either update on a Mac machine or ignore the errors. The update is entirely optional.
     
  24. priznut

    priznut

    Joined:
    Apr 19, 2012
    Posts:
    20
    Hello prime31,


    Question regarding this plugin.


    I am currently getting a crash when I try to log in facebook then requesting to reauthorize. I currently have it setup like so:

    Code (csharp):
    1.  
    2. FacebookManager.sessionOpenedEvent += facebookOnLogin;
    3. FacebookBinding.login();   
    4. FacebookBinding.reauthorizeWithPublishPermissions( new string[] { "publish_actions" }, FacebookSessionDefaultAudience.Everyone );
    5.  

    Is this the valid way to to do it. Or should I reauthorize AFTER the player has logged in?



    Also in the facebook configuration. Should this be setup as a web app or a native app?
     
  25. prime31

    prime31

    Joined:
    Oct 9, 2008
    Posts:
    6,426
    @priznut, that absolutely will not work. You must listen to the appropriate events and take action based on the result of each action. See the demo scene for a functioning example.
     
  26. prime31

    prime31

    Joined:
    Oct 9, 2008
    Posts:
    6,426
    @priznut, that absolutely will not work. You must listen to the appropriate events and take action based on the result of each action. See the demo scene for a functioning example. Is your app native or a web app? If it is a native app then set it up as native.
     
  27. priznut

    priznut

    Joined:
    Apr 19, 2012
    Posts:
    20
    Ahh yeah was wondering if these were discrete steps. After looking at the example that explained the crash bug. I set it up correctly now though. This is a very different setup then what you had prior.

    Very disappointed Facebook changed their system like this. We already have so many users opt out of facebook, this is now an extra barrier to entice users to log in now. Ah well.

    Again thanks for the hard work prime31! Much appreciated.
     
  28. DoktorAce

    DoktorAce

    Joined:
    Jul 13, 2012
    Posts:
    12
    Hi!

    I'm sorry if this question has already been answered here, but Its very hard to get an overview.

    My problem is that when I user clicks the "Connect to Facebook"-button in our game, and the phone switches to either the Safari or Facebook-app, our game gets closed. This only happens on older devices and is probably due to the phone wanting to free up some memory.

    The result is that when you approve the app in Facebook, and get switched back to our game. The game gets restarted from scratch, and we don't get any success or fail callbacks from your API. And so the Facebook authorization process does not work.

    What is the expected behavior here?

    Thank you very much!
     
  29. prime31

    prime31

    Joined:
    Oct 9, 2008
    Posts:
    6,426
    @doktor, that is most definitely a low memory situation. Reduce your memory usage to keep your app from getting shut down. No events will fire if your app is shutdown because your event listeners will of course no longer be wired up because the app was shutdown.
     
  30. koki

    koki

    Joined:
    Nov 27, 2009
    Posts:
    43
    I'm trying to post on twitter timeline using Social Network Android plugin. I get the event "requestSucceededEvent" fired but nothing is posted to the user timeline. Any ideas?
     
  31. prime31

    prime31

    Joined:
    Oct 9, 2008
    Posts:
    6,426
    @koki, post Andrpid questions in the Android forum and if you have issues with Twitter itself you need to contact Twitter. We cannot access their server data.
     
  32. sama-van

    sama-van

    Joined:
    Jun 2, 2009
    Posts:
    1,723
    Hello,

    Longtime I didn't get any problem with your plugins!

    Well, recently a colleague reported a bug from an app I wrote including your plugins for Twitter...

    It seems if the user installed the Twitter App on his device, each time he launches my app, the Twitter sheet pop.
    If I "send", it closes and pop again... and if I "Cancel", it closes and pop it again and again.

    And the message is exactly the same from my code... then very strange.

    If I delete the twitter app, no more pop up.
    And everyone tried, most of them do not have Twitter App, and it works perfectly...


    Did you ever heard about a such issue before?


    Edit: getting a loop message from Xode Console :

     
    Last edited: Feb 27, 2013
  33. prime31

    prime31

    Joined:
    Oct 9, 2008
    Posts:
    6,426
    @sama, it sounds like an error in your code. You can confirm by testing with the demo scene which works perfectly.
     
  34. autowash

    autowash

    Joined:
    Oct 14, 2012
    Posts:
    18
    Hi,

    I've heard great things about this plugin, so I purchased it but it seems I need to get over a few bumps in order to see the promise land =) I have googled a lot and read a little in this thread, but it's so long so please forgive me for not reading through all the posts...

    So, a few questions:

    1. Says on your page that there shouldn't be any *Manager scripts on the game objects, but still there is a FacebookGUIManager in the example ("FacebookTestScene"). Is this scene up to date with that comment? Maybe just an unfortunate naming of that script?

    2. Is the plugin (in general, and FacebookTestScene in particular) supposed to work in the Unity Editor or do I need to compile on iOS to test?

    3. The init(appID) has been replaced with just init(), with I suppose depends on me putting the "fb" + appID in the in the CFbundle URLschemes? But your example here seems to use both. Is there an up to date tutorial anywhere, with all the steps according to the latest API?

    4. I have a registered the app on itunes connect but not yet uploaded a binary, so very much still in dev phase. I do have a bundle ID and an App store ID though. And, I have a facebook developer account where I registered this app, but it says that the app is not yet registered with app store, so it's not a valid reference... Is there any way for me to test the message posting, image posting etc. without this? If not, in what stage of development / testing can you actually get around to testing the social features? I've never gone through a deployment process before, so if you have any insight into this I'd appreciate it.

    For the beginners out there (me included), it would be nice to have an up to date tutorial (youtube or otherwise) that goes through the basic steps. There is stuff out there from other developers, yes, but most of it is obsolete... It would be nice to have the comfort of you guaranteeing an up to date walk through of the basic steps. Or perhaps there is an updated one and I haven't found it =)

    Thanks
     
  35. prime31

    prime31

    Joined:
    Oct 9, 2008
    Posts:
    6,426
    @autowash,

    1. The FacebookGUIManager is fine. The docs are referring to the previous prefab (FacebookManager)

    2. True native code plugins will do nothing in the editor. They can only run on the operating system they were made for.

    3. You must put the Facebook appID on both locations like the documentation details.

    4. I usually stick the Apple ID of an app already released in there while testing.

    Facebooks documentation is always up to date and is always the best place to learn the requirements and steps to setup a Facebook app.
     
  36. autowash

    autowash

    Joined:
    Oct 14, 2012
    Posts:
    18
    Thanks!

    Looks like I manage to do "show post message dialog" (which uses the FacebookBinding.showDialog) in the FacebookTestScene, and the post shows up as "posted via [my app]". The "post message" also works the same way. However the "post score" says "you must first retrieve the app access token before posting a score", even though I've done "get access token" (and the log does spit out some long string...). Is there a setting I'm missing?
     
  37. prime31

    prime31

    Joined:
    Oct 9, 2008
    Posts:
    6,426
    @auto. the only way you will get that error is if the app access token is null.
     
  38. autowash

    autowash

    Joined:
    Oct 14, 2012
    Posts:
    18
    Then I'm confused :( This is what I get... Again, this is directly from FacebookTestScene.

    First I log in, check if session is valid etc, all OK.

    Then, I get the token, log says:
    "access token: BAAINetcetcetcetcetcetcetcetcetcetcDZD"

    I.e. not null, right?

    Then (directly after), I try PostScore, log says:
    "you must first retrieve the app access token before posting a score
    etcetcetcetc
    score post suceeded? False"

    Is there a setting I've not done properly in either FB dev or in the plugin, you think? Or am I just doing it wrong...
     
  39. prime31

    prime31

    Joined:
    Oct 9, 2008
    Posts:
    6,426
    @auto, that is an access token not an app access token. Review Facebooks docs to learn the difference.
     
  40. autowash

    autowash

    Joined:
    Oct 14, 2012
    Posts:
    18
    Right, I'll have a look.

    Thanks for speedy feedback!
     
  41. hong88

    hong88

    Joined:
    Dec 10, 2012
    Posts:
    14
    Hi prime31, I would like to ask about the current Twitter API is which version ? As I know there is an update of Twitter API within March, isn't?
    If I buy it now can I receive update after this or I need to pay to upgrade the plugin that I have buy?
     
  42. Strategos

    Strategos

    Joined:
    Aug 24, 2012
    Posts:
    255
    Hi I have a webplayer facebook game that gets friends lists fine on all browsers except Safari. Is there some issue with Facebook authentication access tokens etc on Safari only ?
     
  43. devbr

    devbr

    Joined:
    Dec 26, 2011
    Posts:
    65
    Hello prime31. There is a C# code for simultaneous usage of iOS and Android:

    Code (csharp):
    1.  
    2. #if UNITY_ANDROID
    3.     using FacebookAccess = FacebookAndroid;
    4. #elif UNITY_IPHONE
    5.     using FacebookAccess = FacebookBinding;
    6. #endif
    7.  
    I would like to know if there is an equivalent approach for javascript. I tried to replace "using" to "import" with no sucess. I did not found any reference about making this kind of "alias" with javascript while googling around...

    Thanks!
     
    Last edited: Mar 7, 2013
  44. jackclarck

    jackclarck

    Joined:
    Mar 8, 2013
    Posts:
    2
    you have done great work,keep it up. i hope you will get some good benefit against your working in future. wish you very best of luck
     
  45. rockpin-games

    rockpin-games

    Joined:
    Feb 4, 2013
    Posts:
    17
  46. prime31

    prime31

    Joined:
    Oct 9, 2008
    Posts:
    6,426
    @devbr, consult Unitys documentation to learn of UnityScript support using statements. C# is a real .NET language and is well documented so we can only safely say for sure that it works there.


    @hong, you set the API version yourself with every request you make.
     
  47. rockpin-games

    rockpin-games

    Joined:
    Feb 4, 2013
    Posts:
    17
    ...
     
    Last edited: Mar 14, 2013
  48. rockpin-games

    rockpin-games

    Joined:
    Feb 4, 2013
    Posts:
    17
    Another question:
    Does the plugin can run on ios 4.2.1? I'm trying and I get 6 errors

    - FacebookManager.mm:192:7: Use of undeclared identifier 'ACAccountTypeIdentifierFacebook'; did you mean 'ACAccountTypeIdentifierTwitter'?
    - FacebookManager.mm:200:87: Use of undeclared identifier 'ACAccountTypeIdentifierFacebook'; did you mean 'ACAccountTypeIdentifierTwitter'?
    - FacebookManager.mm:208:68: Expected ')'
    - FacebookManager.mm:208:65: C++ requires a type specifier for all declarations
    - FacebookManager.mm:210:8: Use of undeclared identifier 'error'
    - FacebookManager.mm:211:58: Use of undeclared identifier 'error'


    I'm using Xcode 4.4.1 and I've tried with SDK for iOS 5.1 and 5.0.
     
  49. prime31

    prime31

    Joined:
    Oct 9, 2008
    Posts:
    6,426
    @rockin, it runs fine on 4.x. You still have to build it with the latest iOS SDK though. Your dev tools are way out of date and you cannot even submit an app to Apple using tools that old anymore.
     
  50. autowash

    autowash

    Joined:
    Oct 14, 2012
    Posts:
    18
    I'm posting on twitter... First post I tried worked fine. All subsequent posts fail, though the postSuccededEvent is fired. The postFailedEvent is not fired.

    I have tried posting something else in between attempts, in case Twitter filters out duplicates.

    Anyone got the same problem?