Open VitaliyZaharenko opened 4 years ago
@VitaliyZaharenko, I ran into the same issue as I was migrating from CocoaPods to Swift Package Manager. It turned out that I was also still importing Promises as a pod. Removing the pod seems to have fixed the issue.
I successfully used Promises in one project until the moment I decided to break it into modules and get "Fatal error: Cannot cast AnyObject to AnyObject" when trying to "then" on promise. It promise returns some class, which implement some public interface.
I created a simplified version of what was happened in the repository on the link
This workspace have a main project and an module as .framework. For clarity of what was at first in my project, i create SomeMainClass and SomeMainStruct. Also I have protocol, which describe provider, thats return promise parameterized with SomeMainClass, SomeMainClass and it's have MainModuleProvider thats implement this provider interface. On other parts of project I use this provider and call "then" on Promise, that's return this provider. All is work as expected.
On the other part in the module I have SomeModuleClass and SomeModuleStruct, ModuleProviderProtocol thats return Promise and Promise. Main project defines ModuleProvider, which implements ModuleProviderProtocol.
I also have some consumer of this provider in Module. When I'm trying to consume provider, i have precondition failure: Cannot cast AnyObject to AnyObject.
Additional Info Promises: 1.2.8 Xcode: Version 11.3 (11C29) Apple Swift version 5.1.3 (swiftlang-1100.0.282.1 clang-1100.0.33.15) Mac Os 10.14.6