Td: file_id is invalid after reconstructing td::Client

Created on 3 Apr 2018  路  6Comments  路  Source: tdlib/td

Currently I'm building an iOS app using tdlib, the first problem was, when user minimizes the app sockets are closed down, so td::Client crashes. Now I destruct client object every time when app goes background and recreate when it goes foreground.

And now there's another problem, previously saved file_ids are no longer available for download. Every downloadFile request fails with "400 - Invalid file id".

How do one save file ids for later download?

Most helpful comment

All 6 comments

There should be no crash if sockets are closed, it is an ordinary situation. What exactly happens?

Yes, file.ids aren't persistent. If you want to have file downloads persistent across application restarts, currently you need to save file.remote.id and use getRemoteFile to get the file after restart. file_type in getRemoteFile call can be specified as NULL in that case.

Thanks for reply.

If sockets are closed, there's this error

[1522774473.039885044][Fd.cpp:362][!Session:2:download_small]   [PosixError : Socket is not connected : 57 : Read from fd 31 has failed]"

screen shot 2018-04-03 at 7 54 48 pm

Yes, try what offers @levlam. It is interesting to look at the result

Thank you, I've recompiled tdlib using the patch you suggested, and everything works even without reconstructing td::Client object.

Also, I'm using remote file ids now, and everything works as expected.

"PosixError : Socket is not connected" error handling is fixed in 1.3.0. There is no crash anymore.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

Invision70 picture Invision70  路  3Comments

Losses picture Losses  路  3Comments

FJarvan picture FJarvan  路  3Comments

isopen picture isopen  路  5Comments

nikolayozhogov picture nikolayozhogov  路  5Comments