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

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.

Related

Xcode stuck on start loading project

My xcode stopped working properlly and I don't know why.
By launching my flutter project in Xcode today da loading runner is infinity and app does not respond anymore.
This happens with any project even if i start a new project the problem is the same.
Can you help please ?
(I reinstalled Xcode 14.2 the problem is the same)
Issue image
I already tried to delete cache files, reboot the mac, reinstall xcode.
Nothing worked
I had the same problem, only opened the project after disabling iCloud

React Native: What is the difference between running app with Xcode vs `react-native run-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

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.

Installing on Iphone gets stuck after setting up firebase_messaging

Following the Readme of the https://github.com/flutter/plugins/tree/master/packages/firebase_messaging I set up the IOS and Android firebase. On Android it works but when I try to install the app by running "flutter run" on IOS, it gets stuck at installing it and I can't open it.
After I took the screenshot a new line appeared under "Installing and launching", "Configuring firebase for this app..." (or something like this).
I tried deleting the pods and set up again.
I tried deleting the app so it can be installed again.
I that at some point during the "Installing and launching..." the app tries to open but closes back immediately. Is it a crash? How do I get some sort of info regarding this? Thank you!
check these two things:
For iOS, the firebase_messaging functionality only works on real devices, it doesn't work on the simulator. (it does work in Android emulator)
Run open -a xcode ios/ and try to build the app there (⌘R), there will be more details on possible errors, specially regarding filling in the Signing section. Even if it's not signing, you will find out what it is, and after fixing it, the flutter cli will resume running without issues.

React Native App crashes on Launch Screen on device

I'm starting with React Native, everything works fine in the iOS simulator. I decide to try it on a device.
The app launches, I can play with it, I close/reopen it around 4 or 5 times, and then somewhat randomly the app crashes on Launch Screen (the one with "Powered By React Native"). It just shows the screen, and the app crashes to the iPhone home screen.
Any idea how I can further debug that?
Edit: I added Bugsnag in my AppDelegate.m, but bugsnag doesn't detect anything when the app crashes.
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
NSURL *jsCodeLocation;
[BugsnagReactNative start];
// Rest of code
}
I came across this issue today. Read a few SO posts and saw one guy mentioned if your app launches and hangs on the splash screen and then crashes with no error it probably has something to one of your npm dependencies.
After digging deeper i saw the react packager was throwing the error
This error is caused by a #providesModule declaration with the same name across two different files.
To fix
check / clean up dependencies(check for same name declerations)
rm -rf node_modules
rm -rf $TMPDIR/react-*
npm i
This can caused by many issues it seems. Recently this happened to me and I had to search a bit to find out the exact reason.
I'll save you guys the trouble by sharing few places I read
- https://github.com/facebook/react-native/issues/14500#issuecomment-348063910
- https://github.com/facebook/react-native/issues/17276#issuecomment-357538208
In my case it was a library issue which I have not linked properly.
-https://github.com/ivpusic/react-native-image-crop-picker/issues/204
So yeah! my point is, it's something we have done or not done. Bit more research would help!!!
I had a similar issue. My application crashed on emulator device every time I ran the application without throwing any error in the console.
Here are a bunch of solutions that might work:
Solution 1 Remove node_modules
rm -rf /node_modules
npm install
Solution 2 Remove /android/app/build directory (This one worked for me)
rm -rf /android/app/build
After this, uninstall the application from emulator device and then run your application again
I was also facing the same issue on real device and it was working fine on simulator. So, i have fixed my issue by given solution
Solution: i have uninstall the application from simulator and then installed it again. This time it showed me the actual error on simulator that i had made mistake.
I finally solve this error by running the app in release mode from xcode
goto Product->Scheme and then click edit Scheme
Select run from left side menu
change Debug to Release
untick Debug executable
now clean the project and run your app in release mode
Some time you have to delete pods and install again after doing above
look for your error in xcode console in my case VS code has imported a Library I just have to remove that import
I had this problem also, what triggered it for me though was updating react and react-native.
I did a build after updating and then I experienced the same issue. I downgraded back to the previous versions of react and react-native, but that didn't work for me.
I tried removing node modules, and reinstalling, that didn't help. Then I noticed that when I was building: react-native run-ios,
the files in ios/build were not updating
I rm -rf ios/build/ and then I react-native run-ios and the ios/build folder populated. My app ran fine after that.
For me lottie package was creating problem. After removing the package able to launch the package.
Make sure by checking the last package/packages installed
In my case it was the Firebase GoogleService-info.plist file which was missing that is supposed to be present in your project.xcodewrkspc when opened using XCode. Adding that resolved the issue.

Resources