23

I've been developing an App using React Native and when I switched to a Mac environment to set up the configurations for ios, after all the setup has been done, the app opens very quickly and closes after the installation, showing that powered by react native screen. I noticed that in my packager screen, the line from the bundle which shows a progress of how much has been loaded does not appear, as if it has never been loaded. Same thing happens if I try to run the code from Xcode.

Here is the screen I'm talking about, for a test project I started for comparisson purposes:

enter image description here

And here is the same screen for my App, without the progress indicator being displayed:

enter image description here

I tried following some solutions provided by the comunity for similar issues but none of them worked. Note that no error message is displayed in my terminal window, as if the build and installation has been succesfull.

Can someone help me with this one? I've been strugling with this App for quite some time, as react native always seems to crash and display error messages for me. Any help would be much appreciated :)

Edit: forgot to mention that I'm trying to run the app on the simulator since I don't have an actual device.

Gabriel Schneider
  • 605
  • 2
  • 6
  • 12
  • I am experiencing the same issue... will let you know if I find anything. – JackDev Feb 12 '18 at 09:34
  • I'm having the same issue mate. I was developing on a linux environment and when I changed my app to a Mac env, I'm facing the same issue. I download everything for android and it is working normally. The problem is when I try to run on iOS. I think it's a good idea if you open an issue on their github repository. Just a quick question: are you using react-native-firebase and/or facebook-sdk (FBSDK)? – Rafael Grilli Mar 15 '18 at 02:23
  • @RafaelGrilli Yes, I'm using react-native-firebase. The "solution" I found was creating a new react native project, copying all the code into it and configuring all the dendencies again. For each dependency I would test if the app would run and in the end I did not face the same issue. I still have no clue to why this happened – Gabriel Schneider Mar 16 '18 at 12:12
  • @GabrielSchneider, if you still with your old project yet, type in the console "react-native log-ios", try to open the app and then you'll be able to see what is the problem. I found out that it was because of the firebase library that I wasn't importing correctly. – Rafael Grilli Mar 17 '18 at 13:17
  • @RafaelGrilli sorry for the late response. I have to say I did not think of logging to see for any errors, good idea. Thank you – Gabriel Schneider Mar 23 '18 at 20:13
  • I found the reason ,which is because of `isomorphic-fetch` npm module – Sai Ram Aug 07 '18 at 04:47
  • You need to check your xcode console. – Ashwin Mothilal Aug 09 '18 at 05:20

8 Answers8

18

Exactly this problem happened to me yesterday when I too installed react-native-firebase. I ran react-native run-ios and the app closed as soon as it opened without any specific errors.

I decided to run the app from Xcode, so I opened the Xcode project. To be more precise I opened the <Project>.xcworkspace because I installed CocoaPods. And there inside the logs I when trying to run the app I found the error. It said that the GoogleService-Info.plist was not found. And as I was looking through the Xcode workspace I did not see the file there, although it existed under /ios/<Project>/ in my IDE (VSCode). So maybe just a syncing problem.

So basically I added the file in Xcode as well, re-run and app was running fine.

Of course, I have no idea if I can find some sort of credible sources about this, but this exact issue happened to me under the exact same circumstances as yours.

Andrei Olar
  • 2,270
  • 1
  • 15
  • 34
  • I accidentally added GoogleService-Info.plist to /ios/// and it caused my app to fail like this until I moved it to /ios// – Jose Dec 17 '20 at 23:12
2

Some solutions ...

  • If you are in latest react version then try to downgrade it.
  • Re-start your application and try to run again.
  • Delete node modules folder and run using npm install.
  • Try to open project using XCODE and build through it.

    Most probably the problem is with your react version. Try to downgrade to stable react version and try
Akila Devinda
  • 5,054
  • 3
  • 19
  • 35
1

Check the log for errors, run react-native log-ios on the terminal and monitor it for errors.

or you can enable Debug JS Remotely option from the simulator by pressing command+D and check the console for errors.

Moh .S
  • 1,920
  • 19
  • 19
1

Try to use adb logcat *:E, this will be helpful when you trying to find issues not related js.

0

I depends on the version of your react-native, if you are using its latest version , 0.56.0 (for now) it has a known issue, which you can see here, and it is suppose to be fixed in next version 0.57.0

https://github.com/facebook/react-native/issues/19953

although the issue raised for android version, but it has similar issue in ios (the latest comment, provides more info about the error)

for now the possible fix is to downgrade to 0.55.4 or 0.55.0

if this couldn't solve your issue, Please provide more information about your app with adding package.json and build.gradle info to the question

Nasser Hadjloo
  • 12,312
  • 15
  • 69
  • 100
0

Add firebase crashlytics or open again and again that app, so it navigates to the log screen to find the issue. Mainly it caused by the misconfigured pod settings. So please check your Podfile. because all the other errors are comes in app's internal error console. I'm attaching the Non error formed Podfile for your reference. It's only the example

Podfile

require_relative '../node_modules/react-native/scripts/react_native_pods'
require_relative '../node_modules/@react-native-community/cli-platform-ios/native_modules' 
platform :ios, '12.0'

target 'iospodapp' do 
  config = use_native_modules!  
  use_react_native!(
    :path => config[:reactNativePath],
    # to enable hermes on iOS, change `false` to `true` and then install pods
    :hermes_enabled => false
  ) 
  permissions_path = '../node_modules/react-native-permissions/ios'
  pod 'Permission-LocationAlways', :path => "#{permissions_path}/LocationAlways.podspec"
  pod 'Permission-LocationWhenInUse', :path => "#{permissions_path}/LocationWhenInUse.podspec"
  pod 'Permission-MediaLibrary', :path => "#{permissions_path}/MediaLibrary.podspec"
  pod 'Permission-Notifications', :path => "#{permissions_path}/Notifications.podspec"
  pod 'Permission-PhotoLibrary', :path => "#{permissions_path}/PhotoLibrary.podspec"

  pod 'YogaKit'  
  pod 'Firebase/Performance'
  pod 'Firebase/Messaging'    
  pod 'RNVectorIcons', :path => '../node_modules/react-native-vector-icons' 
  pod 'react-native-orientation', :path => '../node_modules/react-native-orientation'
  pod 'RNFS', :path => '../node_modules/react-native-fs'

  target 'iospodappTests' do
    inherit! :complete
    # Pods for testing
  end

  # Enables Flipper.
  #
  # Note that if you have use_frameworks! enabled, Flipper will not work and
  # you should disable the next line.
  
  use_flipper!() 

  post_install do |installer|
    flipper_post_install(installer)
    installer.pods_project.targets.each do |target|
      target.build_configurations.each do |config|
        config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'] = '12.0'
       end
    end 
  end
end

Note:

  1. If you're using the firebase, don't forget to add the GoogleService-Info.plist into your ios directory through xcode.
  2. If you're using firebase analytics that also makes the crash. because it needs too more configurations to avoid the crash. so check your build without firebase analytics first. If everything is fine, you can add the analytics later
Karthikeyan Ganesan
  • 1,901
  • 20
  • 23
0

If it occurs without any major changes close Terminal, Emulator and any other application related. clean the project clean cache

npm start -- --reset-cache

clean and Install pod file

Cd IOS && podinstall

Rebuild the project.

0

I'm experiencing the same issue since yesterday, the app Im working on is old we are using "react": "16.8.3", "react-native": "^0.59.10", although the app used to work for me properly before, I cloned a fresh copy of the app from the github repo and it worked for the first time, then I again issued the same command npx react-native run-android and after installing the app should open while opening it starts to crash with no error, I see similar metro bundler screen as has been shared in the question. I tried to run the android folder via android studio I could see one issue which Im not able to resolve since yesterday

/node_modules/@react-native-community/netinfo/android/gradle.properties (Operation not permitted)

which Im not able to figure out how to solve.

Sami Ullah
  • 717
  • 8
  • 14