【问题标题】:API_ID error on x64 Telegram TDLIB (not x86)x64 Telegram TDLIB(不是 x86)上的 API_ID 错误
【发布时间】:2022-11-27 02:37:00
【问题描述】:

使用 Telegram TDLIB 时,我有一个奇怪的行为。我已经为 C++ Windows 库编译了 TDLib,现在有了用于 Win32 和 Win64 的 tdjson.dll。 我的应用程序使用的是 WIN32 版本,没有任何问题,但是当我尝试通过 setTdlibParameters 和 JSON 在 Win64 上设置 TdLib 参数时,出现以下错误:

{"@type":"error","code":400,"message":"Valid api_id must be provided. Can be obtained at https://my.telegram.org"}

我什至使用与 WIN32 版本中相同的 JSON 字符串:

{"@type":"setTdlibParameters","parameters":{"database_directory":"C:\\tdlib","use_file_database":true,"use_chat_info_database":true,"use_message_database":true,"use_secret_chats":true,"api_id":123456789,"api_hash":"5485ed51254e12547ae5555555e555d0","system_language_code":"en","device_model":"Desktop","application_version":"0.1","enable_storage_optimizer":true}}

但是,我总是遇到 WIN64 的无效 API_ID 错误。为什么相同的 JSON 请求不适用于 x64 DLL 版本?

任何帮助深表感谢。

【问题讨论】:

    标签: json 64-bit telegram tdlib


    【解决方案1】:

    我的问题在这里得到了回答:https://github.com/tdlib/td/issues/2211

    从 TDLib v1.8.6+ 开始,必须内联 setTdlibParameters 值,我可以在您的 JSON 示例中看到您没有内联参数。

    要内联 setTdlibParameters 值,请删除键/数组参数。所以你的 JSON 会是这样的:

    {
    "@type":"setTdlibParameters",
    "use_test_dc":false,
    "database_directory":"",
    "files_directory":"",
    "database_encryption_key":"",
    "use_file_database":false,
    "use_chat_info_database":false,
    "use_message_database":false,
    "use_secret_chats":false,
    "api_id":1245678,
    "api_hash":"xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
    "system_language_code":"en",
    "device_model":"Desktop",
    "system_version":"",
    "application_version":"0.1",
    "enable_storage_optimizer":false,
    "ignore_file_names":false
    }
    

    这在 TDLib 1.8.6+ 中应该可以正常工作。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2018-07-24
      • 1970-01-01
      • 2020-07-25
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多