React Native: What is the difference between running app with Xcode vs `react-native run-ios`? - ios

I know that clicking run in Xcode builds and runs the project. But running react-native run-ios also builds and runs it. What's the difference other than that Xcode has more specific error messages?

react-native run-ios
is nothing but a CLI to help get you started with much more easier and faster ways to boot up the app. But for this command to execute you need to have Xcode installed and the build settings should be set to legacy so that it can be build and run properly.
The thing is suppose you want to run an app, opening the xcworkspace in your Xcode and then launching xcode , then indexing etc takes a lot of time.
SO thats where the CLI ,
react-native run-ios
helps to build faster. but at the end its the same build. This article will explain beautifully how it works. rn-ios
Hope it helps. feel free for doubts

Related

React Native iOS starts the development server but never connects and then just crashes

So I run my react-native iOS app from Xcode or react-native run-ios like normal. The server starts and says "Loading dependency graph, done." as normal. The app boots up on the simulator and then stays on the splash screen for around 20 seconds then crashes. It never seems to be able to find the development server and it doesn't print any error in the console.
I haven't been able to solve this issue for the life of me today. I've tried every solution I can find. If someone has any insight, please let me know. Thanks!
How to overcome :
cd ios && pod install
then Open in Xcode (project.xworkspace)
then clean and build project with Xcode
Ok so I ended up updating everything... Xcode, react native (0.60), my node_modules, and cleaned and rebuilt and finally everything works properly now. Updating took some time but it was worth it.

Don't succeed running a react native app from Xcode (running the same app from cli work just fine)

When I try to run the app on a real device or emulator (running from Xcode) I get stuck on splash screen and able to see 'Loading dependency graph'
However, if run it from command line like react-native run-ios --simulator="iPhone 8" everything works just fine and I have no problems.
What might cause the problem? Thanks
try starting the bundler in a separate terminal window, e.g., npm start -- --reset-cache and then run Xcode.
OH MY GOD
Being a deep js believer, I actually had never used Xcode and furthermore had never put any effort towards debugging.
Turns out, I accidentally put a breakpoint somewhere in main.m that has been causing the issue. I didn't notice it and now everything works just fine when I removed it.

React Native iOS Build in Release configuration freezes on Launch Screen

I have an application built using React Native 0.58.6. The iOS build works fine in Debug configuration, but not when built in Release configuration. I can reproduce this on our build server and also locally using react-native run-ios --configuration Release.
This app worked previously in Release configuration before upgrading RN version. Does anyone have any tips for how to find out more information about what may be going on or how to fix this? The app does not crash or show any errors, just stays stuck on the LaunchScreen.xib.
Edit 1
The build works and progresses past the loading screen in the following configurations: Android/Debug, Android/Release, iOS/Debug. It is only the iOS/Release build that is failing. Also, we've tried various xCode versions including 10.1, 10.2, and 10.2.1. Still getting the same result with each version of xCode.
Any tips on how to debug something like this? With no crash, we aren't getting crash reports, and since it's a release build there is no debugging capability or console logging.
If you are using react-native-splash-screen you maybe forgot to hide it.
import SplashScreen from 'react-native-splash-screen'
...
SplashScreen.hide();

React Native app not running in XCode iOS simulator

I try to make my first steps using React Native. Development for Android (on Windows host) works. Now I wanted to test iOS, and tried to set up a development environment on a MacBook Pro.
Problem: React Native starts the iOS simulator, and then nothing happens any more. The simulator runs OK, but my React native app won't start.
What do I need to do to get my React Native installation going?
More Info:
I set up XCode and React Native according to the docs on the MacBook Pro running OSx 10.13.2 (High Sierra). XCode was installed and tested successfully, including the simulator.
When I installed Node.js I deliberately picked an older version (containing npm 4.2.0), since forums say that React Native does still have problems with npm 5. I also installed Homebrew and Watchman, like stated in the docs.
To initialize an empty project, I used
create-react-native-app HelloWorldProject
and a projet structure got created in my Documents folder.
If I finally fire up my "Hello World" test app using
cd HelloWorldProject
sudo react-native run-ios
the system responds:
Starting packager ...
Starting simulator ...
and then nothing happens. The simulator does indeed start (boot --> apple logo --> progress bar --> IOs start screen), but nothing happens afterwards.
Edit
I have given up on React Native for several reasons, I leave this question here for documentary purposes, but I cannot verify or accept any answer, I don't have a React Native development environment any more.
It's probably because you used sudo. /.expo/ is owned by root. Try to change the ownership with
sudo chown -R `whoami` ~/.expo
Refer https://github.com/react-community/create-react-native-app/issues/422
Even everything in your app seems fine, sometime you face the issue that the app is taking too much time to load either through terminal or Xcode. If there is no any other specific issue with your project, the following solution works most of the time:
Go to your app folder and then go to 'iOS' folder.
Delete 'Podfile.lock' and 'Pods' folder.
Execute the following command in Terminal from your 'ios' folder, that will bring back the 'Podfile.lock' and required Pods will be installed to 'Pods' folder:
pod install
Delete the 'build' folder in your 'iOS' folder.
Run the following command in terminal:
react-native run-ios
While the terminal is running, open '.xcworkspace' in your 'ios' folder in Xcode.
The above steps will make sure it will be build your react native project newly and will run on the simulator.
Thanks
Wasantha Wijayaratna

Develop React-native IOS app

when I developed the first app I got error .I'm new to react
please help me to find a solution.
I install npm,node,flow,watchman ,homebrew
Your package server isn't running. This should start automatically when you hit run in xcode, but you can also start it manually. From the project's root, run npm start

Resources