react-native integrating with existing ios apps - ios

Have followed the instructions from here:
https://facebook.github.io/react-native/docs/embedded-app-ios.html#content
I am able to install required react sub specs and react spec with pod install
I was able to run the local react server to serve the bundles as well.
But I am seeing the following issues which is preventing my app from starting up in the iOS simulator.
/.../node_modules/react-native/React/Executors/RCTContextExecutor.m:560:7: Comparison of function 'JSGlobalContextSetName' not equal to a null pointer is always true
/.../node_modules/react-native/React/Base/RCTRootView.m:230:17: Method override for the designated initializer of the superclass '-initWithFrame:' not found
Can anybody help decyphering whats going on? Seems like it is specific to the RCTRootView implementation inside react library.

i figured the problem was with where i started the react-native app. It was not running from the project root. fixing that fixed the starting of the app in the simulator and these warnings werent the real root cause.

Related

Set up React Native project without using react-native-cli

So I'm learning React Native now, and I'm wondering how to set up an app manually, without using react-native-cli. The reason is that I want to set up app code within another project, but whenever I try to move code from a react-native-cli app to another folder containing other project code, I get build errors when running npx react-native run-ios (specifically, xcodebuild errors out with exit code 65). Actually, even if you create a project with react-native-cli and then just change the folder name you get the same build error.
I have template repos I use to start React projects, and I'd like to set one up for native projects, but it looks like it's not possible with the react-native-cli workflow. Is there another way to initialize a React Native project? I know the React docs have a section on integrating RN with existing native apps (https://facebook.github.io/react-native/docs/integration-with-existing-apps), but I don't have an existing native app, I'm starting a new one!
I have scoured the documentation and found nothing on this. Is there any way to find out what commands are run by react-native-cli? How can I set up my RN app from scratch?
EDIT: yes I have heard of Expo! It's all over the RN documentation. I'm asking about how to do the things that react-native init does, but with a more specialized/templated project structure.
As per latest react native documentation, the easiest way to get started is with Expo CLI. Expo is a set of tools built around React Native and, while it has many features, the most relevant feature for us right now is that it can get you writing a React Native app within minutes.
Expo also helps in testing app on phone via QR code.

XCode Project Invalid Bundle on App Store Upload

When submitting our app to the app store the validation process for the build keeps getting rejected with the following error.
Invalid Bundle - One or more dynamic libraries that are referenced by your app are not present in the dylib search path.
Has anyone else had issues with this error? I feel like I've tried just about everything. I'd done the suggested otool -L on the main app as well as the watch app. The only library that it shows linked for is the Mixpanel library. The only other two libraries we are using is Fabric and Crashlytics. From my understanding those are not actual real frameworks? I've also tried to set ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES to YES as many posts online suggest. The project builds and runs fine so I'm completely lost as to how to resolve this issue.
This is a React Native iOS app if that has anything to do with it. I'm not the most experience when it comes to iOS stuff but I can find my way around xcode. Anyone have any suggestions? Maybe the best solution is to just create a new xcode project and set everything up again and copy/paste in the code from the previous project?

Lexical or Preprocessor Issue React Native

I'm trying to test my React Native v0.40.0 application on my physical iPhone 6s device. I've been having a ton of issues and not sure why. When building the application, it says it succeeds but shows a fatal error 'cxxreact/JSBundleType.h' file not found under Buildtime errors and the application doesn't get installed onto my phone. Additionally, I managed to install it once a few days ago, but was having issues making api calls since the call was being made to localhost so I believe the fetch() calls weren't resolving correctly. I found this article https://tylermcginnis.com/test-your-react-native-app-on-your-iphone-or-ipad-c632b4beb3ed/ but the AppDelegate.m file is different now so I don't know how to make the modification that everyone is suggesting. Any ideas?
I hit this issue and found answers no where...I wish a had a better solution for you but what worked for me was running react-native upgrade and resetting everything :/

React Native - Packager not starting

I've been going through some React Native courses and storing all my apps in a 'projects' folder. Everything has been working fine, but all of a sudden I seem to be having some issues with the packager not automatically starting up when i run react-native run-ios while I'm in the specific project's folder. The simulator pops up, but it only shows my previous apps and doesn't contain the new one I just created with react-native init new-app. I've been searching around and I can't seem to find any solution to this. Any thoughts?
This is the last line showing in the terminal:
IDEDerivedDataPathOverride = /Users/[MY_USER]/Documents/projects/new-app/ios/build
So after some digging and testing, I realize the issue is tied to the new feature in Sierra that stores your files in iCloud Drive. Not sure exactly of the specifics, but the issue was resolved when I turned this feature off.

react native for ios seems to include a library from a previous project

So I am trying my first few tutorials with react native and therefore am still quite unfamiliar. I had followed this tutorial for using an npm camera in an IOS app. The camera worked find but I had to go an link this library for the camera. I tried it both the manual approach and rnpm. However, now I have a different tutorial on the go which I was messing around with prior to the camera one, and the simulator throws this error.
undefined is not an object (evaluating 'CameraManager.Aspect'), and further down there is also an error about a file which I know was only in my other tutorial(because I wrote it).
So this seems to me like xCode or the node modules for react are somehow still holding this code. I had previously added an entry to the header search paths under the projects build settings, but I looked at it and this path I needed for the camera is not there. So I don't know where this is coming in from.
I ran react-native run-ios on my project, and I tried cleaning the product in xcode and running from there. So far I haven't had very much luck figuring this out.
Ok so this was a simple human error on my behalf. I will post an answer to it anyhow as it might help some react-native beginners. So I had recently made the switch from linux to OSX, and when I started on there linux I had always run the packager for react native manually, and then I found out on OSX I can just run react-native run-ios in the root of the project and it starts another terminal window with the packager running.
The react-native packager was causing the issue. When I ran the react-native run-ios command the following day(didn't turn off my computer) the packager in the other window was forgotten about and I thought it be smart enough to kill that process and restart a new packager for the other project, but it didn't. Hopefully if anyone makes the same assumption you can save some time with this answer.

Resources