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

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

  1. prime31

    prime31

    Member

    Joined:
    Oct 9, 2008
    Messages:
    6,424
    @sam, just drag the image into your Xcode project and it will be included in your app bundle.
  2. samizzo

    samizzo

    Member

    Joined:
    Sep 7, 2011
    Messages:
    60
    Oh, thanks! But then when I do a "replace" build in Unity it will stomp that, won't it?
  3. prime31

    prime31

    Member

    Joined:
    Oct 9, 2008
    Messages:
    6,424
    @sam, yup. You could use StreamingAssets as well. Check the Unity docs for the details.
  4. samizzo

    samizzo

    Member

    Joined:
    Sep 7, 2011
    Messages:
    60
    Ahh thanks very much for your help. I'll use StreamingAssets.
  5. daveMiller1980

    daveMiller1980

    New Member

    Joined:
    Jul 27, 2010
    Messages:
    8
    @sam - Glad to hear you've got it working- could you post the version of your facebook app please?
    Thanks,
    Dave
  6. Deoxyz

    Deoxyz

    Member

    Joined:
    Dec 13, 2009
    Messages:
    38
    Does anyone know how to logout completely on iPad?

    When I login and go back to the beginning (logout is called) and want to login again with an other account, I'm still logged in with the first account.
    If I don't use logout(), my iPad doesn't open safari webbrowser the next time I want to login.

    It's like you say to the app you are logged out, but not to the browser.
    I used login with extended permission to get the users email address.

    I hope someone can help me with this.
    Thanks in advance.
  7. prime31

    prime31

    Member

    Joined:
    Oct 9, 2008
    Messages:
    6,424
    @Deoxyz, I believe I responded to your email already. The Facebook logout method has no control over Mobile Safari. It sounds like what you need to do is turn off cookies and remembering passwords in Mobile Safaris settings.
  8. daveMiller1980

    daveMiller1980

    New Member

    Joined:
    Jul 27, 2010
    Messages:
    8
    @Prime - My previous issue with logging in via the Facebook App is now solved, all working perfectly!
    I don't know if this is a result of your bug report or some other fb activity- but either way, thank you for the quick response :)
  9. Nick_Field

    Nick_Field

    Member

    Joined:
    Jan 24, 2011
    Messages:
    23
    Hi, Prime.
    I have a problem. When I login with permits (email) and do a custom request, as a result I get mail in a format xxxx@proxymail.facebook.com, but I need direct email for registration in my app. Any suggestion?
  10. prime31

    prime31

    Member

    Joined:
    Oct 9, 2008
    Messages:
    6,424
    @nick, you will have to check with Facebook for that. I have no idea if it is possible to not get a proxy email.
  11. Nick_Field

    Nick_Field

    Member

    Joined:
    Jan 24, 2011
    Messages:
    23
    I found what the problem and trying to solve it. Thanks for the answer!
  12. Nick_Field

    Nick_Field

    Member

    Joined:
    Jan 24, 2011
    Messages:
    23
    The server returns email in "mail@mail.com" format. And I need to decode this string. System.Web.HttpUtility is unavailable and I don't know, how I can decode this string.
  13. Griffith

    Griffith

    New Member

    Joined:
    Oct 19, 2011
    Messages:
    20
    Hi Prime,

    Am I doing something wrong here? All logged in to Twitter. I'm trying to get a list of followers for the logged in user.

    Dictionary<string, string> dic = new Dictionary<string, string>();
    TwitterBinding.performRequest("GET", "/statuses/followers.json", dic);

    I get the message saying it's successful however if I check the size of the Dictionary it's 0. There are definitely followers on the logged in account.

    Thanks in advance
  14. prime31

    prime31

    Member

    Joined:
    Oct 9, 2008
    Messages:
    6,424
    @griffeth, check out the demo scene and how it handles requests. Anything that requires a round trip to the server doesn't return anything because it takes time to get the data. Events are used to signal when the data is ready.
  15. ratrodstudio

    ratrodstudio

    Member

    Joined:
    Apr 3, 2009
    Messages:
    211
    Anyone figured out the proper settings to use for Facebook? we are having issues with the plugin as well.
    Thanks

    UPDATE: Never mind, I did more test using the new auth login, it looks pretty cool (icon support and all). Now everything seems to work. :)
    Last edited: Oct 19, 2011
  16. Griffith

    Griffith

    New Member

    Joined:
    Oct 19, 2011
    Messages:
    20
    Cheers - nailed it
  17. Griffith

    Griffith

    New Member

    Joined:
    Oct 19, 2011
    Messages:
    20
    I looked around but couldn't find this out - so if I log in with my account into my twitter app and do a custom request it's fine. However if one of my friends tries to log in (After I log out or after restarting the app) I get the error

    request: /1/statuses/followers.json?
    error: This method requires authentication.

    If anyone has seen this before please let me know. It's weird that it's fine if I try and not if the others do (using the oauth method)
  18. Griffith

    Griffith

    New Member

    Joined:
    Oct 19, 2011
    Messages:
    20
    Never mind, it seems like it just takes a while to start working for some reason
  19. Griffith

    Griffith

    New Member

    Joined:
    Oct 19, 2011
    Messages:
    20
    With the twitter plugin, Ok I feel like there's an issue or I'm not understanding something. When I start the app and log in, I get the successful login callback and everything work fine. If I then log out and log in with someone else's account (with oauth both times) when I request anything I get "could not authorize" until I close and open the App again which proceeds to fix it.

    Any ideas.
  20. prime31

    prime31

    Member

    Joined:
    Oct 9, 2008
    Messages:
    6,424
    @Griffith, iOS devices are inherently single user devices so little things like this pop up when trying to go multiuser. What is most likely happening is that the webview is caching some cookies that aren't purged until app shutdown.
  21. Griffith

    Griffith

    New Member

    Joined:
    Oct 19, 2011
    Messages:
    20
    Ok I'll see what I can do
  22. ThanNewell

    ThanNewell

    New Member

    Joined:
    May 4, 2011
    Messages:
    9
    I'm not following. How can I make an app request with the graph api? Also, I *believe* with the just released facebook iOS stuff there should now be facebook supplied views you can use.
  23. prime31

    prime31

    Member

    Joined:
    Oct 9, 2008
    Messages:
    6,424
    @ThanNewell, which part are you not following? The Graph API covers getting the raw data. If you want to use a Facebook provided view there is a showDialog method available that lets you pass in the custom dialog type and params.
  24. ThanNewell

    ThanNewell

    New Member

    Joined:
    May 4, 2011
    Messages:
    9
    @Prime31 Hrmm... I feel like there is a fundamental disconnect here, most likely on my part. In Javascript, I can call:

    FB.ui({
    method: 'apprequests',
    message: 'My app request message',
    title: 'My app request title',
    to: some_user_id,
    },
    function(response) {});

    This will send an app request to some_user_id. I just need something similar on the iOS. It sounds like you are suggestion I don't use the plugin at all and open a browser? Is this sort of thing not something exposed in the facebook C# sdk?
  25. prime31

    prime31

    Member

    Joined:
    Oct 9, 2008
    Messages:
    6,424
    @Newell, the Facebook JS API and the native Facebook Connect are two fundamentally different SDKs. I am not familiar with the JS SDK and there is nothing in the native SDK specifically called "apprequest". The native SDK revolves mostly around the Graph API. You will want to focus your search in the native SDK docs and the Graph API to see if Facebook exposes what you need to native code.
  26. ThanNewell

    ThanNewell

    New Member

    Joined:
    May 4, 2011
    Messages:
    9
    It looks like app requests can sorta be done with a graph API call.

    The code I have that seems to do the trick:

    Hashtable graphParams = new Hashtable();
    graphParams.Add( "Message", "Come play my app!" );
    graphParams.Add( "title", "Invite your friends!" );
    graphParams.Add( "to", sendToFBUserID );
    FacebookBinding.graphRequest( "/me/apprequests", "POST", graphParams );

    Edit 1: Unfortunately, the response I get back is, "Unsupported method, apprequests". Since I can't get back the ID, I can't delete it from the server... so this isn't a real option.

    Edit 2: Passing in the access token gave me back a valid request ID. Huzzah!
    Last edited: Oct 23, 2011
  27. unitybro5000

    unitybro5000

    New Member

    Joined:
    Apr 30, 2010
    Messages:
    4
    Apologies if this has already been answered, but are there any plans in the pipeline for a twitter/facebook plugin using iOS5's new social networking integration?
  28. prime31

    prime31

    Member

    Joined:
    Oct 9, 2008
    Messages:
    6,424
    @unitybro, iOS 5 has no Facebook integration and we already have a Social Networking Plugin that has both integrated. At some point, once iOS 5 adoption is enough we will add support for the tweet sheet as well.
  29. Jason H

    Jason H

    Member

    Joined:
    Nov 5, 2010
    Messages:
    77
    @Prime31

    Hello! I'm trying to upload an image to Twitter with a message although I'm getting this error in Xcode;

    image file does not exist at path: http://www.robotroadies.com/1.jpg

    Would it be better to save the file in the app itself as I already have it saved but I wasn't sure on what the string's format should be to reference it. Some thing like "Assets/images/image1"?

    Here is the code I'm using;

    Code (csharp):
    1. twitterMessage = GUI.TextArea (Rect (Screen.width*0.227, Screen.height*0.241, width, buttonHeight*3-10), twitterMessage, Screen.height*0.21875);
    2.  
    3. if( GUI.Button( new Rect(/*218+(width*0.1666)*/Screen.width*0.2083, Screen.height*0.4719,  width*0.6, buttonHeight), "Post Status Update") )
    4. {
    5.    TwitterBinding.postStatusUpdate( twitterMessage ,  "http://www.robotroadies.com/1.jpg");
    6. }
    Last edited: Oct 26, 2011
  30. prime31

    prime31

    Member

    Joined:
    Oct 9, 2008
    Messages:
    6,424
    @jason, the image has to be stored on the device. A local path to the image is required. Check out the demo scene for an example.
  31. JohnLeeroy

    JohnLeeroy

    New Member

    Joined:
    Jun 8, 2011
    Messages:
    68
    Hey everyone,

    I have problem with the facebook part of the plugin. It worked a few days ago but recently, when I log into the app and try to get an access token through FacebookBinding.login, i get an error "Cannot open page, Safari cannot open the page because the address is invalid". Does anyone know how to solve this?

    I'm not sure if this is related to the login problem found two pages ago.
  32. prime31

    prime31

    Member

    Joined:
    Oct 9, 2008
    Messages:
    6,424
    @John, double check your plist setup and be sure to delete the app from your device between tests.
  33. NiklasKarlsson

    NiklasKarlsson

    New Member

    Joined:
    Jun 8, 2011
    Messages:
    4
  34. prime31

    prime31

    Member

    Joined:
    Oct 9, 2008
    Messages:
    6,424
    @Niklas, it sounds like you may have rejected the login at some point while testing. You may have luck going to the Facebook website in your user account and digging through their permissions. Find your app in there and just remove anything you find to get a fresh start.
  35. Griffith

    Griffith

    New Member

    Joined:
    Oct 19, 2011
    Messages:
    20
    All of a sudden today, my request to friends/ids now returns a hash table instead of array list and the data I get back seems to be incorrect.

    Eg:

    previous_cursor_str: 0
    next_cursor: 0
    previous_cursor: 0
    next_cursor_str: 0
    ids:
    --------------------

    --------------------

    --------------------

    --------------------

    --------------------

    --------------------


    I get no ids and just these lines :/ quite strange considering yesterday it was fine. Anyone else experience this? (thinking it's more of a twitter api issue than the plugin though :()
  36. prime31

    prime31

    Member

    Joined:
    Oct 9, 2008
    Messages:
    6,424
    @Griffith, there was a change that went live on Twitters servers yesterday. Check their dev portal or Google Group for the details. If I recall it has something to do with passing the cursor to the method.
  37. Jason H

    Jason H

    Member

    Joined:
    Nov 5, 2010
    Messages:
    77
    We intend on uploading the binary to our game shortly, however I was doing some last minute checking on what might get the app rejected and found this blog post: http://gtproductions.net/blog/ways-to-get-rejected-by-apple-app-store-tips/ (although it is from 2009 so Apple's requirements may be different now?)

    It mentions that an app can be rejected for not notifying a user that there info will be sent over a network and I was wondering whether this has affected anyone when they try and log in or post messages with the functions available in this plugin. And whether it's made anyone's apps get rejected.

    Here's the text from the site I'm on about;

    "
    14.) Handling user data
    If you collect user information and the data is sent over a network, you need to explain to the user what will happen to their data and give them an option to opt out. For example, leaderboards require certain notification to the user that even their bogus name used on the high score boards will be sent over the internet and seen by others.
    "

    Prime do you know anything about this?
  38. prime31

    prime31

    Member

    Joined:
    Oct 9, 2008
    Messages:
    6,424
    @jasonh, I have never seen an app rejected for this nor have I seen any app notify me that it was going to send data out. I wouldn't worry much about it.
  39. petero181

    petero181

    New Member

    Joined:
    Feb 23, 2011
    Messages:
    104
    Hi, sorry for newbie question. Just bought your social networking plugins yesterday. So the problem is like this :
    1. I build the apps from unity3D ver 3.4.1f5
    2. A dialogbox came up "SocialNetworking Unity support successfully integrated!
    3. I run xcode ver 4.0.2 and plug my iphone and run the apps from xcode
    4. when the xcode build the apps ... I got an error message :
    [​IMG]

    What should I do ? Where am I doing wrong ? thx
  40. prime31

    prime31

    Member

    Joined:
    Oct 9, 2008
    Messages:
    6,424
    @petero, assuming you are building against iOS 5 I would suggest closing Xcode completely and doing a Build followed by Replace from Unity. It looks like you may have just gotten a bad build.
  41. petero181

    petero181

    New Member

    Joined:
    Feb 23, 2011
    Messages:
    104
    @prime31, am I need to upgrade to iOS5? I have close the xcode and delete all file inside and build from the beginning. And the error message still the same. I am using Unity3D indie for iOS version, and below this is my xcode and unity3d version.

    [​IMG]

    [​IMG]

    unity3D ver 3.4.1f5
    xcode ver 4.0.2

    Please help .... thx
  42. prime31

    prime31

    Member

    Joined:
    Oct 9, 2008
    Messages:
    6,424
    @petero, you are using an old version of the iOS SDK. You must build against iOS 5.
  43. Matkins

    Matkins

    New Member

    Joined:
    Aug 24, 2009
    Messages:
    141
    I just tried to import the Social Network package into my project and there's a problem with there being 2 MiniJSON files. Deleting the one in the social network plugin causes the compiler to complain that MiniJSON does not contain a definition for 'jsonDecode', deleting the one in the UIToolkit plugin causes the compiler to complain that there's no definition for 'JsonDecode'. The difference being lower case j and upper case J.

    Presumably the latest version of UIToolkit has been updated to conform to your lower case methods. Unfortunately it's far too late for me to just update UIToolkit for this project, i've made numerous changes and i dread to think of all the things that would break if i do an update now.

    All my attempts of converting either plugin produce more errors that I just dont' understand.

    What do you suggest I do?
  44. prime31

    prime31

    Member

    Joined:
    Oct 9, 2008
    Messages:
    6,424
    @Matkins, you have an old version of UIToolkit for sure. The easiest path to fix things is to delete the UIToolkit MiniJson.cs file and leave the Social Networking one. There will just be a copule minor compilation errors left and they are easily fixed by changing the capital 'J' to lowercase 'j' (MiniJson.jsonEncode/Decode).
  45. Matkins

    Matkins

    New Member

    Joined:
    Aug 24, 2009
    Messages:
    141
    Ok, it wasn't as painful as I feared. All sorted, Cheers.
  46. DarkJedi

    DarkJedi

    New Member

    Joined:
    Apr 15, 2009
    Messages:
    48
    I've been using the SocialNetworking plugin for a while, but as I was out of date with three of the plugins (last updated August) I thought I'd be "tidy" and start over with the plugins, and import them from scratch.

    I'm now getting the following exception in XCode as soon as the plugin is referenced in code...
    Code (csharp):
    1. 2011-11-08 18:50:43.608 testapp[9795:707] -[Facebook initWithAppId:andDelegate:]: unrecognized selector sent to instance 0x7a5c330
    2. 2011-11-08 18:50:43.630 testapp[9795:707] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[Facebook initWithAppId:andDelegate:]: unrecognized selector sent to instance 0x7a5c330'
    I have of course re-attached the SocialNetworkingManager prefab to the scene, added the Facebook app ID into the Info.plist Additions, chmod +x'd the PostprocessBuildPlayer scripts (as recommended by the Plugin Troubleshooter) and output to a fresh (replaced) XCode build folder, but no luck as yet.

    I'm sure I've just forgotten something silly - any ideas? :confused:

    Thanks,
    Dan
  47. prime31

    prime31

    Member

    Joined:
    Oct 9, 2008
    Messages:
    6,424
    @DarkJedi, it looks like you still have some old files hanging around in there. Be sure to do a Build followed by Replace to get a fresh Xcode project. It is often a good idea to do a Product -> Clean when large changes are present as well to clear out the object cache in Xcode.
  48. DarkJedi

    DarkJedi

    New Member

    Joined:
    Apr 15, 2009
    Messages:
    48
    Thanks!
    Starting over a second time with the plugins, hosing the build directory (not just replace), running an XCode clean and shouting at the screen seems to have resolved it, and I'm up and running again :)

    For others with similar symptoms, I think shouting at the screen is what fixed it.
  49. Griffith

    Griffith

    New Member

    Joined:
    Oct 19, 2011
    Messages:
    20
    Hey Prime, back to the issue I was having about people logging out etc. It seems that even if it's the first login for anyone, the App has to be restarted before it can do anything that requires authorisation.

    For example if someone buys the app and logs in they will have to restart the App before my requests work.

    Any ideas if this is something I'm doing wrong? I've seen other games that don't require a restart. There's no log out call made it's just the first time login.

    Thanks

    (Oh btw it's a twitter login not facebook)
  50. prime31

    prime31

    Member

    Joined:
    Oct 9, 2008
    Messages:
    6,424
    @Griffith, are you seeing that behavior with the demo scene? I can't reproduce it on my end.