How to Debug Common React Native issues on iOS?

 

In this article, you will get to see some of the issues that you might face at the time of developing iOS apps with React Native. You will get to learn how to debug common React Native issues on iOS. The issues we are going to talk about in this article are as follows.

  • Software dependency problems
  • Third-party package issues
  • Issues when running on the device
  • Expokit issues


Debugging checklist

Before solving the issues you must take care of certain things first. It will help you save some time while developing iOS apps with React Native.

1. Check the troubleshooting section of the React Native docs You will find a troubleshooting section in the React Native docs. At the time of running the app on an iOS device, you will also find another troubleshooting section.

2. Update Xcode to the latest version An outdated version of Xcode leads to build fail. Visit the Updates tab in the App Store and hit update. Then restart your computer once you are done updating it.

3. Set up a personal team for Xcode Set up a provisioning profile, in your order to project on your iOS device.

4. Deep-clean the project Make sure you are not caching anything which will break your build. After doing this, you can execute npm install again and re-run the projects.

Software dependency problems

The application has not been registered

If you notice that the application is not registered, it is caused by an old bundler instance which is still unable to run. It’s a good practice to stop running instances of the metro bundler by pressing ctrl + c or ⌘ + c on your keyboard. Once you have done this, you can execute react-native start to re-run the bundler with the correct project.

If the problem still occurs, it might be because you are using a different project name from the time when you started the project. The name should be the one mentioned in the AppRegistry.

Third-party package issues

Unmet peer dependency

Here, the issue is often caused by the third-party modules that you install. When you install React Native Maps and you see the package.json file, the peer dependency doesn’t include React Native version 0.55.

This is a warning that React Native Maps won’t work as expected if your project uses a different version of React Native. You can try running your project first. If the build succeeds then there’s a good chance that the version works.

If you found that the build is breaking, you can try and find a solution to this. You can downgrade the version of React Native for your whole project. You can make use of a lower version of React Native Maps. If you have a lot of other third-party packages already installed on your project, then it is a good option. So we’ll go with that.

Issues when running on a device

Code signing is a compulsory step for running apps on an iOS device. It makes sure that the apps installed on iOS devices are from a known source. iOS app developers will get an error code if not properly set up to sign the project.

Click on your project name in the project navigator on Xcode. Click on the General tab. You will notice that there is no team assigned to the project.

The bundle identifier generated in React JS development services is already taken. You must come up with a more unique name as a solution to this. It can help in automatically creating the provisioning profile after moving out of the text field.

Running the project again on the device will definitely work the next time. But if it doesn’t, then you might be facing an error. Click on each of the project targets. Now select the same team used earlier. After this, your project will run easily on the device without a problem.

ExpoKit issues

Here you will get to see some of the issues which you might encounter at the time of using ExpoKit. ExpoKit is an Objective-C and Java library. It allows you to make use of Expo’s APIs. Very few React Native developers will use Expo or ExpoKit. But it is optional.

In order to avoid problems, you should make sure that the project is properly set. Open the app.json file. Make sure that the name is set to the same name as when you first created it with exp init. You then include the platforms that you want to build for. Add a unique bundle Identifier in case of iOS. Now repeat the step where you can check the name of the app.json file.

Now navigate the ios directory and execute pod install. ExpoKit uses Cocoapods to manage the dependencies. But when detach ExpoKit doesn’t install the pods automatically.

Conclusion
The above-mentioned are some of the most common React Native issues faced by React Native developers and iOS app developers. This will help solve your most common issues. If you need professional help, you can hire React Native developers.

——————————————————————————————————————————-

Author Bio:

Roma Kapadiya is a Web Researcher and an SEO Consultant associated with well-known firm for Nimblechapps which is one of the best mobile app development company in India and the USA. She also likes to share the researched knowledge with the audience by engaging blogs. Her write-ups mainly features anything and everything related to the upcoming technology, startups, programming tools, and web!

 

STAY UP TO DATE

Sign up today to stay informed with industry news & trends