ios - 推特登录 swift 4
问题描述
我想在我的应用程序中实现 twitter 登录,但出现错误。
Class TWTRAppAuthProvider is implemented in both /Users/mohamedeldewaik/Library/Developer/CoreSimulator/Devices/1F7EFA9B-EB86-4E18-8386-284E21A73F92/data/Containers/Bundle/Application/37DD8EB8-2854-44CB-ABAD-3FDADA0FCD1E/alharamin pass.app/Frameworks/TwitterKit.framework/TwitterKit (0x105296548) and /Users/mohamedeldewaik/Library/Developer/CoreSimulator/Devices/1F7EFA9B-EB86-4E18-8386-284E21A73F92/data/Containers/Bundle/Application/37DD8EB8-2854-44CB-ABAD-3FDADA0FCD1E/alharamin pass.app/Frameworks/TwitterCore.framework/TwitterCore (0x10510e370). One of the two will be used. Which one is undefined.
我在下面的代码中尝试了这个,但它崩溃了
TWTRTwitter.sharedInstance().logIn(completion: { (session, error) in
if (session != nil) {
print("signed in as \(session?.userName)");
} else {
print("error: \(error?.localizedDescription)");
}
})
这是我的应用委托
import TwitterKit
@UIApplicationMain
class AppDelegate: UIResponder, UIApplicationDelegate {
var window: UIWindow?
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {
TWTRTwitter.sharedInstance().start(withConsumerKey:"XzbZgtanfchiPGRRpII1gu70Z",consumerSecret: "4cNlyYssitGQjoWob4eGnBYeCVP20yVNL9P7w9fI4TzhO4RGKg")
return true
}
func application(_ app: UIApplication, open url: URL, options: [UIApplicationOpenURLOptionsKey : Any] = [:]) -> Bool {
if TWTRTwitter.sharedInstance().application(app, open: url, options: options) {
return true
}
return true
}
}
那么如何在没有这个错误的情况下实现 twitter 我越来越多地搜索解决方案,但我没有得到正确的答案。
解决方案
您是否在仪表板中添加了回调 URL,如下所示
twitterkit-CONSUMERKEY://
推荐阅读
- c++ - 归并排序中数组的索引号有问题吗?
- javascript - 基于来自另一个组件的某个名称的 React Router 链接
- time - 在 CloudSim 中打印迁移时间
- java - 为什么不需要处理 Callable 接口抛出的异常
- php - 如何在 WooCommerce 中编辑“woocommerce_thankyou”钩子的输出?
- c# - 如何在 c# mongodb 驱动程序中使 mongodb 正则表达式不区分大小写?
- scala - 如何在 Scala 中使用 Play json 更新列表中的每个字段
- c# - 无法从列表中删除重复项
用不同的方法 - ios - 如何获取kCVPixelFormatType_DepthFloat16(半点浮点数)的值?
- mysql - Mysql左连接索引