Problem posting to Twitter using the Unity version of Twitter Kit

twitterkit
unity
csharp

#1

Hi, I am making an app/game that will allow players to post their scores in their Twitter feed if they so wish. I can initialise Twitter and allow the player to login via a button and when they click on the Tweet Score button it shows the correct message and image to tweet. The problem occurs when they click on the tweet button, the screen goes back to the game screen and you assume the Tweet has been posted but when you check your Twitter feed it has not. Here is my compose code:

public void StartTwitterComposer(TwitterSession session, string imageUri)
        {
            Twitter.Compose(session, imageUri, "I got a new hi-score" + hiscore, new string[] { "#videogames", "#gamer" });
        }

any help as to why it wont post would be really helpful.

Thanks


#2

Do you have anymore details? Is there any messages in the log? iOS or Android? On Android you can crate a broadcast receiver to listen for the results.


#3

I think I have the same issue, I get the following error message:

java.lang.NullPointerException: Attempt to invoke interface method 'boolean java.util.List.isEmpty()' on a null object reference
at com.twitter.sdk.android.core.Callback.onResponse(Callback.java:42)
at retrofit2.ExecutorCallAdapterFactory$ExecutorCallbackCall$1$1.run(ExecutorCallAdapterFactory.java:68)
at android.os.Handler.handleCallback(Handler.java:751)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:154)
at android.app.ActivityThread.main(ActivityThread.java:6121)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:889)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:779)

#4

Hello,
Callbacks have now been added to the Tweet Composer, please upgrade to v.3.2.0
https://dev.twitter.com/twitterkit/unity/installation

Example usage:
https://dev.twitter.com/twitterkit/unity/compose-tweets

regards,
Adam


#5

I got this new error message now

at TwitterKit.Internal.TwitterComponent.TweetFailed (System.String error) [0x00023] in /Users/arlefreak/Projects/Games/Unity/scnds/Assets/Twitter/Scripts/TwitterComponent.cs:92


#6

Yeah I got the same problem when using the compose code straight out of the documentation:
https://dev.twitter.com/twitterkit/unity/compose-tweets
I get:
NullReferenceException: Object reference not set to an instance of an object
at TwitterShare.OnTwitterComposeFail (TwitterKit.Unity.ApiError _error) [0x00007] in D:\Projects\Social\Assets\Scripts\Social\TwitterShare.cs:102
at TwitterKit.Internal.TwitterComponent.TweetFailed (System.String error) [0x00023] in D:\Projects\Social\Assets\Twitter\Scripts\TwitterComponent.cs:92


#7

Have you tried posting a tweet using the Twitter Demo scene included in the package? Run that scene alone, login, and it will automatically take a screenshot and pull up the composer.


#8

I got the same problem.

08-18 17:54:25.136 12326 12348 I Unity : Tweet failed
08-18 17:54:25.136 12326 12348 I Unity : UnityEngine.DebugLogHandler:Internal_Log(LogType, String, Object)
08-18 17:54:25.136 12326 12348 I Unity : UnityEngine.DebugLogHandler:LogFormat(LogType, Object, String, Object[])
08-18 17:54:25.136 12326 12348 I Unity : UnityEngine.Logger:Log(LogType, Object)
08-18 17:54:25.136 12326 12348 I Unity : UnityEngine.Debug:Log(Object)
08-18 17:54:25.136 12326 12348 I Unity : TwitterKit.Internal.TwitterComponent:TweetFailed(String)
08-18 17:54:25.136 12326 12348 I Unity :
08-18 17:54:25.136 12326 12348 I Unity : (Filename: ./artifacts/generated/common/runtime/UnityEngineDebugBindings.gen.cpp Line: 37)
08-18 17:54:25.136 12326 12348 I Unity :
08-18 17:54:25.153 12326 12326 W IInputConnectionWrapper: getSelectedText on inactive InputConnection
08-18 17:54:25.159 12326 12348 I Unity : NullReferenceException: Object reference not set to an instance of an object
08-18 17:54:25.159 12326 12348 I Unity : at MoleMole.MonoTest.m__13C (TwitterKit.Unity.ApiError error) [0x00000] in :0
08-18 17:54:25.159 12326 12348 I Unity : at TwitterKit.Internal.TwitterComponent.TweetFailed (System.String error) [0x00015] in H:\work\testsdkGB\Assets\Twitter\Scripts\TwitterComponent.cs:92
08-18 17:54:25.159 12326 12348 I Unity :
08-18 17:54:25.159 12326 12348 I Unity : (Filename: H Line: 0)
08-18 17:54:25.159 12326 12348 I Unity :

Also the demo scene in the package will crash the Unity. My Unity Version is 5.3.4p5.


#9

I am unable to repro the issue. You should at least be able to run the demo scene. Try upgrading to Unity version 2017.1. Or if you want you can package up your demo app and message me the link.