Unity Community |

Just downloaded and installed the latest SocialNetworking_2012-06-12 package. Still experience the issue. Tapping "Cancel, and return to app" link results in just opening my Twitter app callback URL in this window instead of closing it and return to app.
@basurman, did you delete the old files before reimporting? We cannot reproduce when importing into a fresh project.
I have a problem with posting a score to facebook.
giving me this problem;
InvalidCastException: Cannot cast from source type to destination type.
at Facebook+<postScore>c__AnonStorey9.<>m__2 (System.String error, System.Object obj) [0x00000] in <filename unknown>:0
at Prime31.P31RestKit.processResponse (UnityEngine.WWW www, System.Action`2 onComplete) [0x00000] in <filename unknown>:0
at Prime31.P31RestKit+<send>c__Iterator0.MoveNext () [0x00000] in <filename unknown>:0
(Filename: Line: -1)
Is there a way how I can figure out whats going on in this dll file?
I'm able to login, fetch my id, I receive an app id and can receive my friends ids.
@beeky, what are you passing the method? Is your app properly setup on Facebook as a game? Have you tried the demo scene which has a working version of posting scores? Invalid cast exceptions are almost always due to passing invalid types.
I'm passing my facebook id and score,
I have this exception on line 209 in Facebook.cs:
var result = (bool)obj;
completionHandler( result );
I have the same issue with the example.
'Get Scores' is working, post score not at the moment.
app access token retrieved: 411318234448906292|etnSTUAoF9BDt3YTVJf25inOmwM
UnityEngine.Debug:Internal_Log(Int32, String, Object)
UnityEngine.Debug:Log(Object)
SocialNetworkingGUIManagerTwo:<OnGUI>m__7(String) (at /Users/s/FF/src/Assets/Plugins/SocialNetworking/testSupportIOS/SocialNetworkingGUIManagerTwo.cs:134)
<getAppAccessToken>c__AnonStorey8:<>m__1(String, Object) (at /Users/s/FF/src/Assets/Plugins/SocialNetworking/FacebookCommon/Facebook.cs:170)
Prime31.P31RestKitrocessResponse(WWW, Action`2)
Prime31.<send>c__Iterator0:MoveNext()
(Filename: /Users/s/FF/src/Assets/Plugins/SocialNetworking/testSupportIOS/SocialNetworkingGUIManagerTwo.cs Line: 134)
InvalidCastException: Cannot cast from source type to destination type.
at Facebook+<postScore>c__AnonStorey9.<>m__2 (System.String error, System.Object obj) [0x00006] in /Users/s/FF/src/Assets/Plugins/SocialNetworking/FacebookCommon/Facebook.cs:209
at Prime31.P31RestKit.processResponse (UnityEngine.WWW www, System.Action`2 onComplete) [0x00000] in <filename unknown>:0
at Prime31.P31RestKit+<send>c__Iterator0.MoveNext () [0x00000] in <filename unknown>:0
(Filename: /Users/s/FF/src/Assets/Plugins/SocialNetworking/FacebookCommon/Facebook.cs Line: 209)
@beeky, you didn't anser all the questions I asked. Is you app properly setup on Facebook as a game? You can turn on debugging by setting the "debugRequests" to true in the Facebook class. Are you requesting the appropriate permissions as well to be able to post scores on behalf of a user?
After some debugging and testing I found my problem.
Facebook was returning an error message what gave the cast exception.
last week I filled in some permissions and the auth token parameter option was set to query string by default.
by turning of this Authenticated Referrals setting in Auth dialog on the Facebook developer page the warning left;
Completely removed the old files and installed the latest version. Unfortunately it didn't help. I suspect that may be something wrong in my Twitter app settings but can't even guess what could it be.
Any ideas?
To localize the problem I created an empty Unity project and imported only latest Social Networking package (SocialNetworking_2012-06-12.unitypackage) to it. Then I added my test Twitter app consumer key and secret to TwitterBinding.init function in SocialNetworkingGUIManager. Then, I run your SocialNetworkingtestScene on iPad, tap "Initialize", then "Login with Oauth", the Twitter login dialog opens. Then I tap "Cancel, and return to app" link and observe the problem I described above (my app callback URL is loaded in dialog above my app, instead of closing this dialog and returning to app).
Can you please have a look at this simple test project and tell me what I'm doing wrong?
EDIT - PLEASE DON"T POST LINKS TO PROJECTS THAT CONTAIN SOURCE CODE TO COMMERCIAL PRODUCTS.
Thanks in advance.
Last edited by dendrophile; 06-20-2012 at 11:25 AM. Reason: remove link
@basurman, your Twitter app setup shouldnt affect that. We cannot reproduce what you are seeing. In addition, please remove the download immediately. Our EULA strictly forbids distribution of the source code of our plugins.
Hey all, I did a small video on how I integrated the prime31 social networking plugin in to our iphone game project.
It uses an older version of the plug-in but I believe it's still quite similar to the newer plug-in.
I hope this is useful anyway. It's not the only way to do it, but just how I added it to the game
Awesome plug-ins prime, keep up the great work
Martin
Free iphone game - www.tinyurl.com/gochickgofree
Fly high, be the best, top your score, brag to your friends!
More updates for Go Chick Go coming soon.
@macfinch, well done Martin! A great resource for everyone and we get to see little you in the corner the whole time![]()
Free iphone game - www.tinyurl.com/gochickgofree
Fly high, be the best, top your score, brag to your friends!
More updates for Go Chick Go coming soon.
Everything is removed, sorry, I didn't want to violate your EULA. I'll continue to deal with this issue and hope will find a solution. Thanks for your help and advices.
Hi, I'm using this code:
Code:
FacebookManager.customRequestReceivedEvent += result => { ResultLogger.logObject( result ); }; } { else ResultLogger.logObject( result ); } private void shareFacebook() { FacebookBinding.init( "xxx" ); if(!FacebookBinding.isSessionValid()) { FacebookBinding.loginWithRequestedPermissions( new string[] { "publish_actions", "user_games_activity" } ); } postMessage(); } private void postMessage() { Facebook.instance.postMessage( "Distance: " + distance, completionHandler ); }
When I'm testing my share botton in the iPhone, when I allow the facebook application and back to the game, in Xcode I receive a EXC_BAD_EXCEPTION in Facebook.instance.postMessage().
My Facebook app is configured as a "Native iOS App" in Games category.
What I'm doing bad?
@zeroz, your code is calling postMessage before login completes. You have to be logged in before you can post a message.
@prime31 when you know if login is complete?
@zeroz, directly from the docs:
// Fired after a successful login attempt was made
public static event Action loginSucceededEvent;
// Fired when an error occurs while logging in
public static event Action<string> loginFailedEvent;
I have added this and I don't know if is correct because I get errors in the same instruction (Facebook.instance.postMessage):
Code:
private void shareFacebook() { FacebookBinding.init( "xxx" ); if(!FacebookBinding.isSessionValid()) { FacebookManager.loginSucceededEvent += OnFacebookLogin; FacebookBinding.loginWithRequestedPermissions( new string[] { "publish_actions", "user_games_activity" } ); } else postMessage(); } void OnFacebookLogin() { postMessage(); } private void postMessage() { Facebook.instance.postMessage( "Distance: " + distance, completionHandler ); }
@zeroz, that looks about right to me though you may want to make sure you are requesting the proper permissions for posting on a users wall without a dialog.