gpt4 book ai didi

android - 适用于 Android 的 Twitter Fabric 登录

转载 作者:塔克拉玛干 更新时间:2023-11-01 21:20:19 25 4
gpt4 key购买 nike

我正在尝试使用 Twitter 提供的新 Fabric API 让用户登录我的应用程序。我完全按照教程进行了操作(至少我认为是这样,也许我犯了一些错误)here在使用所有必要步骤设置我的项目之后;现在,当我点击登录按钮并验证该按钮时,会返回一个成功的响应,但是当我之后去获取 Twitter session 时,我得到一个看起来像这样的异常

Caused by: java.lang.IllegalStateException: Must start Twitter Kit with Fabric.with() first    

(同样,到目前为止,我已经按照教程进行了 T,但是如果您能想到任何东西,那么我愿意尝试一下)

最佳答案

Fabric SDK 将功能分成称为套件的模块。您必须通过 Fabric.with() 指明您希望使用哪些套件。这通常是通过扩展 Android 的 Application 类来完成的。

package com.example.app;
import android.app.Application;

public class MyApplication extends Application {
@Override
public void onCreate() {
super.onCreate();

TwitterAuthConfig authConfig =
new TwitterAuthConfig("consumerKey",
"consumerSecret");

Fabric.with(this, new Twitter(authConfig));

// Example: multiple kits
// Fabric.with(this, new Twitter(authConfig),
// new Crashlytics());
}
}

更多信息:https://dev.twitter.com/twitter-kit/android/integrate

请参阅规范示例应用程序:https://github.com/twitterdev/cannonball-android

关于android - 适用于 Android 的 Twitter Fabric 登录,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26629838/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com