Closed ggoraa closed 2 years ago
Hey, I've been unable to run your app from https://github.com/ggoraa/moc due to missing files in git and reproduce the issue in unit tests even.
I think this is due to ARC weak self
was used for async function execute(query:)
which was removed
https://github.com/Swiftgram/TDLibKit/commit/e39cf70f69c12362e860794ef94a10eafe15d6be#diff-0c4989f772de41032c2478b21eb80fc2c46d6f924f6920fda58ee15f574d92a9L13085
@ggoraa Can you please try with latest TDLibKit version 1.2.0?
Lemme try it, thanks!
And what do you mean "missing files"? Which exactly?
Clone the repo to clean directory and try to build it. Compiler will throw an error about missing source files.
think this is due to ARC weak self was used for async function execute(query:) which was removed
Well, possibly not this was the issue, because the app still fails to execute this statement with the error above
Clone the repo to clean directory and try to build it. Compiler will throw an error about missing source files.
Sorry, this is an issue in master
branch. Can you try the viewmodels+di
one?
I've debugged your app a bit and found out that client is not created on this stage of user flow. It's not nicely handled by framework so you're getting such errors.
The real error is that td client instance is not created. It may be caused by your DI library.
P.S. Thank you for submitting this issue, I will fix error handling soon.
Oh, well that is awkward I have no idea why my DI library refuses to properly init TDLib 🤔 Anyways, thanks for your help! Gonna try fixing the issue
Did some more research on this problem. The thing is - the client is still destroyed, even when I use a totally new instance of TDLib (TdApi(client: TdClientImpl())
)
It is possible that the issue is not my DI library
But the most confusing part is that this thing works fine in TdService, it easily gets the TdApi instance from Resolver and runs functions, such as setTdlibParameters
But it is still broken in LoginView 🤔
well this is confusing
I found even more info
When I place in .onAppear
tdApi.client.run { _ in }
, and then i run setAuthenticationPhoneNumber
, the app just dies with the following error:
_Concurrency/CheckedContinuation.swift:164: Fatal error: SWIFT TASK CONTINUATION MISUSE: execute(query:) tried to resume its continuation more than once, returning Ok()!
If I remove the onAppear
section, then it reverts to the old behavior I explained in the first message
Again, more info If I run the initialization right inside the LoginView, everything works like a charm. I even managed to log in to Telegram! This is definitely an issue with the DI library... this is embarassin'...
It is possible that the issue is not my DI library
It looks like your DI library somehow copies initial TdApi
object and resets it's state.
Big thanks for help! And sorry for bothering you because of issues that i created on my end :(
_Concurrency/CheckedContinuation.swift:164: Fatal error: SWIFT TASK CONTINUATION MISUSE: execute(query:) tried to resume its continuation more than once, returning Ok()!
I've also encountered this bug. Fun fact, it was due to Error()
can be successfully cast to Ok()
type.
It's now handled in latest TDLibKit 1.2.1
with some more error-handling logic that could help debugging later.
https://github.com/Swiftgram/TDLibKit/commit/d8deb5e1cb0793401c065aad71ddba8e29fffb16
This is the message I get when I try to execute a normal function in TDLibKit, such as
setAuthenticationPhoneNumber(phoneNumber:settings:)
. Invocation:Where did I screw up?