Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Xcode Error when trying to build a React Native project on simulator or device

I've had some issues with permissions on the original react native app directory and decided to store my .js files in a separate folder as a backup and recreate the project in the same directory from scratch, hoping to solve the problem.

The new react native project seems to have been created successfully as I was able to build and test in the simulator the basic app. I then re-imported my backed up .js files and linked a particular library i'm using in xcode as well. When I try to build the project from xcode now, to my iphone, I receive the error below:

Undefined symbols for architecture armv7:
"_OBJC_CLASS_$_RCTEventEmitter", referenced from:
  _OBJC_CLASS_$_RCTKeyboardObserver in libReact.a(RCTKeyboardObserver.o)
"_OBJC_METACLASS_$_RCTEventEmitter", referenced from:
  _OBJC_METACLASS_$_RCTKeyboardObserver in libReact.a(RCTKeyboardObserver.o)
ld: symbol(s) not found for architecture armv7
clang: error: linker command failed with exit code 1 (use -v to see invocation)

I looked around as well and found out some references mentioning that I might be missing a .m file but that seems a bit strange to me as I created this project from scratch, but could it be that things might have changed when I imported my .js files?

I was also told to upgrade to react native 0.26 - the upgrade happened but the issue is still there.

This app used to work before so I can't really find from where the issue is coming from.

Any help will be greatly appreciated.

Thanks!

like image 691
pol6880 Avatar asked May 31 '16 21:05

pol6880


People also ask

Can I use Xcode for React Native?

You will need Node, Watchman, the React Native command line interface, a Ruby version manager, Xcode and CocoaPods. While you can use any editor of your choice to develop your app, you will need to install Xcode in order to set up the necessary tooling to build your React Native app for iOS.

How do I enable simulator in Xcode?

Open Xcode and click Menu > Xcode > Preferences > Select Components, and then choose the simulator version you want to download. When a simulator is opened from AppStudio, AppStudio Player automatically installs (if necessary) and opens in it.

How do I run React Native on specific iOS simulator?

You can specify the device the simulator should run with the --simulator flag, followed by the device name as a string. The default is "iPhone 13" . If you wish to run your app on an iPhone SE (2nd generation), run npx react-native run-ios --simulator='iPhone SE (2nd generation)' .

How run iOS app on physical device React Native?

Plug in your device via USB​ If this is your first time running an app on your iOS device, you may need to register your device for development. Open the Product menu from Xcode's menubar, then go to Destination. Look for and select your device from the list. Xcode will then register your device for development.


1 Answers

I did fix this by Cleaning the Project from "Product > Clean" (or Shift+CMD+K)

like image 150
Andreyco Avatar answered Sep 23 '22 23:09

Andreyco