Post not yet marked as solved
Post marked as unsolved with 1 replies, 221 views
Hi everyone,
Let me prefix this question by saying that I am not an iOS developer... so be gentle :-)
A friend has an older codebase (written in xCode 11) that was abandoned by the developers that were working on it. He needed someone to fix Firebase logging (which I did) and everything was fine until recently. Now upon moving to any xCode > 12 there is a runtime error deep in the library code used throughout the app.
The error (slightly generalized) is as follows:
Could not cast value of type '() -> MyApp.TabBarFC' (0x111eda8a0) to '() -> LibraryKit.LibraryFC' (0x111eda8c0).
the respective classes are declared as follows...
in app code:
class TabBarFC: LibraryTabBarFC {
in library code:
open class LibraryTabBarFC: LibraryFC {
The line it specifically crashes on is in a flow controller (FC) repository in the library code where you can see an attempt to cast the app parameter to the class LibraryFC:
var factories: [LibraryKit.Id.FC : () -> (LibraryFC)] = [:]
open func register<FC: LibraryFC>(factory: @escaping () -> (FC), id: LibraryKit.Id.FC) {
factories[id] = factory as! () -> (LibraryFC)
}
This code worked in xCode 11. It does not work now. If anyone could tell me if there is an obvious fix (it could be trivial), it would certainly be faster than giving the entire codebase to someone else or me reading documentation for a few nights.
Thanks!