我在电报TDLIB工作时有一种奇怪的行为。我已经编译了TDLib for C++ Windows,现在有了tdjson.dll for Win32和Win64。我的应用程序使用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无效的WIN64错误。为什么相同的JSON请求不能使用x64 DLL版本?
任何帮助都是非常感谢的。
发布于 2022-11-26 18:21:01
我的问题在这里得到了回答:https://github.com/tdlib/td/issues/2211
从TDLib开始,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+中应该很好。
https://stackoverflow.com/questions/74548809
复制相似问题