XCoordinator icon indicating copy to clipboard operation
XCoordinator copied to clipboard

Crashing push on XCode 14 beta

Open hugovanderlei opened this issue 2 years ago • 8 comments

Crashing push on NavigationController extension, XCode 14 beta 5, is complaining that the method must be made on main thread.

Captura de Tela 2022-08-15 às 11 15 46

hugovanderlei avatar Aug 15 '22 14:08 hugovanderlei

@hugovanderlei can you confirm that trigger is called from the main thread in this case?

pauljohanneskraft avatar Aug 15 '22 14:08 pauljohanneskraft

I tested it in both xcodes, and it always worked on XCode 13, where the method was called on the main thread. However, when I use XCode 14, the method is not called on the main thread, as shown in the images.

I didn't change anything in code, just compiled it in both xcodes.

Captura de Tela 2022-08-15 às 12 08 27

Captura de Tela 2022-08-15 às 12 18 30

hugovanderlei avatar Aug 15 '22 15:08 hugovanderlei

@pauljohanneskraft Same problem here, any news?

joaoduartemariucio avatar Sep 16 '22 13:09 joaoduartemariucio

Same problem. Any news?

canbalkaya avatar Sep 20 '22 09:09 canbalkaya

I will try this out (hopefully today) in one of our apps and get back to you - did anyone already try to fix this? I would assume that for some reason, CATransaction no longer run on the main thread - otherwise it would need to originate from the call site, which would mean this is an RxSwift issue and not a XCoordinator problem.

pauljohanneskraft avatar Sep 20 '22 10:09 pauljohanneskraft

I was able to solve it on my project. On XCode 14, I observed that even when an async trigger method is called by another method with @ MainActor, the trigger method is no longer on the main thread.

I believe adding @ MainActor to the async trigger method might work.

Captura de Tela 2022-09-20 às 07 25 08

In my project, I had to use MainActor.run to call the trigger.

await MainActor.run { router.trigger(.checkAuthentication) }

This forces the trigger async method to be executed on the main thread.

hugovanderlei avatar Sep 20 '22 10:09 hugovanderlei

but this also happens with the non-async methods, right? or is this actually an issue that is isolated to the async overload?

pauljohanneskraft avatar Sep 20 '22 10:09 pauljohanneskraft

In my case it only happened on async methods. I guess something was changed in the Concurrency on swift 5.7

hugovanderlei avatar Sep 20 '22 10:09 hugovanderlei

Any news?

canbalkaya avatar Oct 09 '22 07:10 canbalkaya

any news?

manuel-ceschi avatar Jan 05 '23 10:01 manuel-ceschi

any news?

alessiolapenna avatar Jan 20 '23 05:01 alessiolapenna

any news?

mseverinoPhotosi avatar Jan 23 '23 08:01 mseverinoPhotosi

Sorry for the long wait. I will try to figure out the root cause to this in the coming days - can anyone confirm or deny that this only affects the async extensions and not the regular trigger methods?

pauljohanneskraft avatar Jan 23 '23 16:01 pauljohanneskraft

I pushed a potential fix to https://github.com/QuickBirdEng/XCoordinator/pull/239 - Can anyone confirm that this solves the issue?

pauljohanneskraft avatar Feb 02 '23 14:02 pauljohanneskraft

Hi @pauljohanneskraft, I have tried your fix in all the afflicted sections in my app and everything is fixed. Thank you. My team is looking forward to the new version. well done!

manuel-ceschi avatar Feb 18 '23 11:02 manuel-ceschi

Thank you very much for the feedback - I will try to release it in about a week, hope that's fine. Until then, feel free to specify that branch for now as a temporary workaround.

pauljohanneskraft avatar Feb 18 '23 11:02 pauljohanneskraft

The fix has just been merged and will be released shortly.

pauljohanneskraft avatar Feb 28 '23 16:02 pauljohanneskraft