-
Notifications
You must be signed in to change notification settings - Fork 40
Description
Hello, recently we have made a POC with some basic functionality done in React Native and integrated it into a native app. All 3 frameworks generated by rock (hermes, ReactBrownfield and MyFramework) were added to the app target as embedded frameworks.
Right after running the app I saw these warnings in the console:
objc[1061]: Class PodsDummy_ReactBrownfield is implemented in both /private/var/containers/Bundle/Application/BC5CFCFE-487D-409F-A41E-E3E493EB45BA/Test.app/Frameworks/MyFramework.framework/MyFramework (0x106cede68) and /private/var/containers/Bundle/Application/BC5CFCFE-487D-409F-A41E-E3E493EB45BA/Test.app/Test.debug.dylib (0x10922f7f8). This may cause spurious casting failures and mysterious crashes. One of the duplicates must be removed or renamed.
objc[1061]: Class ReactNativeBrownfieldModule is implemented in both /private/var/containers/Bundle/Application/BC5CFCFE-487D-409F-A41E-E3E493EB45BA/Test.app/Frameworks/MyFramework.framework/MyFramework (0x106cedeb8) and /private/var/containers/Bundle/Application/BC5CFCFE-487D-409F-A41E-E3E493EB45BA/Test.app/Test.debug.dylib (0x10922f848). This may cause spurious casting failures and mysterious crashes. One of the duplicates must be removed or renamed.
objc[1061]: Class _TtC15ReactBrownfield29ReactNativeBrownfieldDelegate is implemented in both /private/var/containers/Bundle/Application/BC5CFCFE-487D-409F-A41E-E3E493EB45BA/Test.app/Frameworks/MyFramework.framework/MyFramework (0x106cedf40) and /private/var/containers/Bundle/Application/BC5CFCFE-487D-409F-A41E-E3E493EB45BA/Test.app/Test.debug.dylib (0x10922f8d0). This may cause spurious casting failures and mysterious crashes. One of the duplicates must be removed or renamed.
objc[1061]: Class _TtC15ReactBrownfield21ReactNativeBrownfield is implemented in both /private/var/containers/Bundle/Application/BC5CFCFE-487D-409F-A41E-E3E493EB45BA/Test.app/Frameworks/MyFramework.framework/MyFramework (0x106cee050) and /private/var/containers/Bundle/Application/BC5CFCFE-487D-409F-A41E-E3E493EB45BA/Test.app/Test.debug.dylib (0x10922f9e0). This may cause spurious casting failures and mysterious crashes. One of the duplicates must be removed or renamed.
objc[1061]: Class _TtC15ReactBrownfield31ReactNativeBrownfieldModuleImpl is implemented in both /private/var/containers/Bundle/Application/BC5CFCFE-487D-409F-A41E-E3E493EB45BA/Test.app/Frameworks/MyFramework.framework/MyFramework (0x106cee228) and /private/var/containers/Bundle/Application/BC5CFCFE-487D-409F-A41E-E3E493EB45BA/Test.app/Test.debug.dylib (0x10922fbb8). This may cause spurious casting failures and mysterious crashes. One of the duplicates must be removed or renamed.
objc[1061]: Class _TtC15ReactBrownfield25ReactNativeViewController is implemented in both /private/var/containers/Bundle/Application/BC5CFCFE-487D-409F-A41E-E3E493EB45BA/Test.app/Frameworks/MyFramework.framework/MyFramework (0x106cee2d8) and /private/var/containers/Bundle/Application/BC5CFCFE-487D-409F-A41E-E3E493EB45BA/Test.app/Test.debug.dylib (0x10922fc68). This may cause spurious casting failures and mysterious crashes. One of the duplicates must be removed or renamed.
Duplicated classes come from ReactBrownfield framework. I used nm command to investigate internals of MyFramework and it looked like it already contained the code from ReactBrownfield.
For example, these symbols are related to ReactNativeViewController:
00000000004a37c8 s __INSTANCE_METHODS__TtC15ReactBrownfield25ReactNativeViewController
00000000006a06d8 s __IVARS__TtC15ReactBrownfield25ReactNativeViewController
00000000006a0690 s __METACLASS_DATA__TtC15ReactBrownfield25ReactNativeViewController
00000000006c62d8 S _OBJC_CLASS_$__TtC15ReactBrownfield25ReactNativeViewController
00000000006cddd8 D _OBJC_METACLASS_$__TtC15ReactBrownfield25ReactNativeViewController
00000000006c6278 s __DATA__TtC15ReactBrownfield25ReactNativeViewController
However, after removing ReactBrownfield from app's dependencies I got a compilation error Unable to find module dependency: 'ReactBrownfield' on line @_exported import ReactBrownfield in arm64-apple-ios.private.swiftinterface inside MyFramework. Apparently ReactBrownfield is needed for exposing public interface.
What I also found is that both hermes and MyFramework are dynamic frameworks, while ReactBrownfield is a static framework, which might explain this behaviour.
I also tried wrapping these frameworks in one SPM package, but the result is the same.
Am I doing something wrong with my setup, or is it an issue with generating frameworks? If ReactBrownfield is a static framework, then maybe it should be compiled into MyFramework and not required in the project? Or maybe it should be dynamic and not compiled into MyFramework?
Thank you for any suggestions or help :)