Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

React Native app works when run from Xcode, but crashes when run with 'react-native run-ios'

Today my React Native app crashed when I ran it using react-native run-ios. The default splash screen would appear, but then it would crash and I would just see the emulator homescreen with my app's icon on the desktop. The Terminal is hanging on "Loading dependency graph, done". It worked fine yesterday, and I haven't changed anything since then. When I run it from Xcode, it works. I've tried all the suggestions at the following four links for getting it to run with react-native run-ios without success: link1 link2 link3 and link4

My Question Is:

Does anyone know why it would work from Xcode and not from react-native run-ios? And does anyone know why it would suddenly start crashing when it worked fine before?

like image 618
gkeenley Avatar asked Aug 22 '19 17:08

gkeenley


People also ask

Can you run React Native in Xcode?

Step 2: Start your application​ You should see your new app running in the iOS Simulator shortly. npx react-native run-ios is one way to run your app. You can also run it directly from within Xcode.

Can React Native run on both iOS and Android?

With React Native, one team can maintain two platforms and share a common technology — React. As you can use the same source code to run on iOS and Android devices, you don't have to hire separate developers to write code for Android and iOS devices.

Is React Native harder than Swift?

Development Speed Here the speed of development with Swift vs React Native will be faster if you develop native iOS Apps. Swift will be the easiest way to create an iOS app, while React Native is a JavaScript framework that is a powerful yet simple working tool for building web applications.

Do I need Xcode to build a React Native App?

If you intend to run it on an iOS device or simulator, the use of Xcode is often required. You can build a React Native app either using the React Native CLI, which allows you to run build commands from your terminal, or Xcode. I prefer to use Xcode for the following reasons:

How do I run React Native on an iPhone SE?

The default is "iPhone 11". If you wish to run your app on an iPhone SE (1st generation), run npx react-native run-ios --simulator="iPhone SE (1st generation)". The device names correspond to the list of devices available in Xcode. You can check your available devices by running xcrun simctl list devices from the console.

How do I run a react-native app in iOS simulator?

Once you have your React Native project initialized, you can run npx react-native run-ios inside the newly created project directory. If everything is set up correctly, you should see your new app running in the iOS Simulator shortly.

How do I preview my react native app on a device?

If you used Expo CLI or Create React Native App to set up your project, you can preview your app on a device by scanning the QR code with the Expo app—but in order to build and run your app on a device, you will need to eject and install the native code dependencies from the environment setup guide. Android.


1 Answers

Some things you can try

Check iOS simulator log after crash:

cat /Users/YOUR_USER_NAME/Library/Logs/CoreSimulator/REPLACE_HERE/system.log

In my case I had

Class RCTBlobManager is implemented in both ... One of the two will be used. Which one is undefined.

And

assertion failed: 19D76 17F61: libxpc.dylib

It did work from xcode 11.5 / iOS 13, but did not work from react-native. I found out that it bug can be tracked by launching app after stopping debug from xcode, if it launches after stop debug then it also worked from react-native

react-native run-ios

In Podfile I have enabled

use_frameworks

Got rid of these by doing 2 things:

enter image description here

Hope at least someone facing these problems this post would give at least some hints

like image 182
Evalds Urtans Avatar answered Oct 30 '22 06:10

Evalds Urtans