I’ve been very quiet lately, this is because I was solving problems, of course ;).
All about native modules.
Again this is not allaboutmadonna.com :):)
My last project for one of my customer involves a lot a native modules for iOS and Android. I’m using:
"appcenter": "1.12.2", "appcenter-analytics": "1.12.2", "appcenter-crashes": "1.12.2", "react-native-ble-plx": "^1.0.2", "react-native-charts-wrapper": "^0.5.0", "react-native-device-info": "^1.0.0",<span id="mce_SELREST_start" style="overflow:hidden;line-height:0;"></span> "react-native-side-menu": "^1.1.3", "react-native-splash-screen": "^3.2.0", "react-native-svg": "^9.2.4", "react-native-vector-icons": "^6.3.0",
I’ve been struggling with automatic integration methods:
And lastly:
- manual integration
Specifically for the iOS project.
Honestly there is room for improvements in the automatic methods. They are not bullet proof and running them more than once may lead to side effects. I even ended up loosing track of knowing which module was integrated with which method, because the recommended automatic method will vary from one project to another.
I may have installed modules with both, while trying to solve below problems. This is the price to pay when dealing with numerous modules and not writing down what was done. My fault.
We’re not in the ‘its just works’ mode for now.
So all the problems depicted below were all solved all at once following each module instructions regarding manual integration.
I also had to deal with a new version of React Native that brings 64-bit support on Android and a new versions 10.2 of XCode (which brings Swift 5). That has not helped.
All right, so what troubled me so far?
No more react native debug menu
I’ve seen a ton a questions on Stack Overflow about this problem and none of the proposed solutions were working for me.
Crash in react native bridge for some native module
I’ve opened an issue on GitHub but it has been closed without an answer. I don’t care anymore.
RCT_EXTERN_MODULE Swift modules broken in Xcode 10.2
That React Native one had weird side effect on my project. Vanished completely with manual integration.
Crash in release mode for react-native-side-menu
Again, I’ve opened an issue about that problem. Solved. Closed.
Class is implemented in both ‘…’ and ‘…’. One of the two will be used. Which one is undefined
I do not know how I ended up here, but I was having React Native classes implemented twice in my project. Gone.
My takeaways: I’m not going back to either automatic integration method.
Ever.
On the dark side, this has been hard for me because all these malfunctions triggered distress that I was not able to share with someone else because I’m working remotely as a freelance. In those moments this is my body that processes my emotions and honestly I don’t like that at all.
But, on the bright side, this has had the benefit to make me better understand how integration works with Both Android Studio and XCode. Of course this is tedious and error prone, but even if I’m looking for ways to create value rapidly by not reinventing the wheel, I could spend some time learning new thinks.
Open Source Software is great actually when done correctly in your context.
By the way : I will soon integrate C++ code with react-native-djinni. So excited.
Hi! I’am new to Xcode and iam struggling with the Binary link and cocoa pods, I have the same problems that you had, except for the one related to react-native-side-menu, but I don’t know how to do the manual integration of the native modules. Could you provide a short explanation of how to do so?
Thanks in advance.
LikeLike
Each native module should explain how to deal with the integration.
What is(are) the module(s) in question?
LikeLike
the module is RCTNativeModule and RCTBridge I think.
here is the piece of code in RCTNativeModule.mm where the app crashes on release
if (m_bridge.valid) {
dispatch_queue_t queue = m_moduleData.methodQueue;
if (queue == RCTJSThread) {
block();
} else if (queue) {
dispatch_async(queue, block); –> in this line it tries to access a invalid memory address giving a EXC_BAD_ACCESS error
}
do you have any idea of what else could it be?
Sorry for the delay to respond, I was expecting a notification on my e-mail but there was nothing.
Thank you.
LikeLike
This code is from the React Native (RCT) side of your module. Your module is the one you installed via yarn/npm.
LikeLike