Lexical or Preprocessor Issue React Native - ios

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 :/

Related

React Native App Crash (Thread 1: EXC_BAD_ACCESS (code=1, address=0x54))

Recently came onto this issue when trying to run my app on the simulator through xCode or the React Native CLI. The bundle loads from localhost then the app immediately crashes with "Thread 1: EXC_BAD_ACCESS (code=1, address=0x54)" in "main.m" in Xcode. I am unable to get the app running even though it builds fine. (even tried running on release instead of debug)
This issue just started recently occurring and I cannot find anything in our Git logs that would cause any kind of issue - all pretty minor changes on the RN side and nothing native. Has anyone seen this issue/knows how to properly trace it? Seems like a super generic error and it is unclear on how to figure out what is actually going on.
Xcode version 11.5, React Native 0.62.0, and targetting iOS 10.
EDIT:
After running the app a few times I was able to get this error in the Xcode Output
For me, running this watchman watch-del-all && yarn cache clean was what worked. I found it on an issue on github. Strange but it worked like magic
After tons of debugging, confusion, and many hours of frustration it came down to removing and readding one dependency. There was no specific error message I could trace or change I could find in our git history that would've caused this. I literally ended up tediously removing code from the App until I found the library that was the problem.

React native Google Signin Issue in Ios

I am using this library For Google-signin : react-native-google-signin
After Integration of the library in ios I am getting an error while running in a real device:
in signalhandler.cc file
No member named '__rip' in '__darwin_arm_thread_state64
Note: It is running fine in simulator. I am getting the error only when running in real devices.
I had this issue when I tried to run from xcode on a physical device...I saw this solution on github and it worked for me
Change this line:
return (void*)context->PC_FROM_UCONTEXT;
to
return NULL;
Check below steps which required to do in xCode:
1) In Libraries folder RNGoogleSignin.xcodeproj is there or not. If not, then drag from node module folder.
2) Add libRNGoogleSignin.a lib into Link Binary in Build Phase.
Hope it will solve your issue.
I was getting the same error as you when I was trying to run an out of box React Native app on my iPhone X. Which I am running Mojave on a MacBook Pro using Xcode 10.
I had no issues running a base React Native app in simulator but have an issue running it with a physical device. While looking in the libraries, I was not able to find RNGoogleSignin.xcodeproj that Nirmalsinh motioned.
So, after some digging I found this thread.
https://github.com/facebook/react-native/issues/16106
It looks like there is a serious bug with Xcode 10 and React Native.
They suggest to take line 78 where it throws the error and just return null and it fixes that error. As below.
ucontext_t *context = reinterpret_cast<ucontext_t *>(ucontext_in_void);
return NULL;
Don't know why that line would throw and error or what that context is actually for, but returning NULL allows me to compile it on the physical device.
Don't know if this fixes your problem, but it might help others who stumbled on to this like I have.
And if it is because its missing RNGoogleSignin.xcodeproj, then there needs to be another way to add that library in as it was there in my folder. Unfortunately, I don't know where you could find it to install it.

How to debug generic React Native error messages on iOS?

Unless I enable debugging (Esc > Cmd+D > Debug JS Remotely) then I see this error:
Module AppRegistry is not a registered callable module
This also means that I'm unable to view the bundled app on device. If I try to view the app on device, but still use the dev server (remembering to use an IP address in AppDelegate.m instead of localhost) then I instead get this error:
WebSocket connection failed with error Error Domain=NSPOSIXErrorDomain Code=61 "Connection refused"
even though I've verified that I can open the dev server URL in a browser on the device.
I'm not an iOS developer, so maybe this is really obvious, but how do I go about debugging why these errors are happening, or just not having these errors in the first place?
One reason could be App Transport Security that was added in iOS 9. Please see https://facebook.github.io/react-native/docs/running-on-device-ios.html#app-transport-security for reference. You have to add the NSAllowsArbitraryLoads entry to your Info.plist yourself if you didn't use the React Native CLI to generate your project.
Although this doesn't really answer the 'How do I debug these kinds of generic errors' question, I've found out that in my case the problem was that I created my app using an older version of RN (maybe 0.26?) that had a bug in the scaffolding code it creates (which I stupidly ignored at the time when I found i could work around it by enabling debugging) and updating to newer versions of the app hasn't fixed the issue because that doesn't cause the scaffolding to be updated. By creating a fresh app under RN 0.29, and copying my code into it, everything is now working as expected.

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.

react-native integrating with existing ios apps

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.

Resources