react-native: Undefined symbol on Flipper using 0.62 on real iOS device
Description
I’m not able to run the 0.62 version of the react native when I target a real device on the XCode. Using the simulator is running normally. I’ve got this error:
Undefined symbol: FlipperState::start(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >)
Undefined symbol: folly::ScopedEventBaseThread::ScopedEventBaseThread()
Undefined symbol: facebook::flipper::FlipperClient::instance()
Undefined symbol: folly::ScopedEventBaseThread::~ScopedEventBaseThread()
Undefined symbol: facebook::flipper::FlipperClient::getStateElements()
Undefined symbol: facebook::flipper::FlipperClient::getState()
Undefined symbol: facebook::flipper::FlipperClient::getPlugin(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&)
Undefined symbol: facebook::flipper::FlipperClient::setStateListener(std::__1::shared_ptr<FlipperStateUpdateListener>)
Undefined symbol: FlipperStep::complete()
Undefined symbol: facebook::flipper::FlipperClient::performAndReportError(std::__1::function<void ()> const&)
Undefined symbol: facebook::flipper::FlipperClient::init(facebook::flipper::FlipperInitConfig)
Undefined symbol: facebook::flipper::FlipperClient::removePlugin(std::__1::shared_ptr<facebook::flipper::FlipperPlugin>)
Undefined symbol: facebook::flipper::FlipperClient::addPlugin(std::__1::shared_ptr<facebook::flipper::FlipperPlugin>)
Undefined symbol: facebook::flipper::FlipperClient::refreshPlugins()
React Native version:
System: OS: macOS 10.15.3 CPU: (8) x64 Intel® Core™ i7-2600 CPU @ 3.40GHz Memory: 1.23 GB / 16.00 GB Shell: 5.7.1 - /bin/zsh Binaries: Node: 13.11.0 - /usr/local/bin/node Yarn: 1.22.4 - /usr/local/bin/yarn npm: 6.13.7 - /usr/local/bin/npm Watchman: 4.9.0 - /usr/local/bin/watchman SDKs: iOS SDK: Platforms: iOS 13.4, DriverKit 19.0, macOS 10.15, tvOS 13.4, watchOS 6.2 Android SDK: Not Found IDEs: Android Studio: 3.6 AI-192.7142.36.36.6241897 Xcode: 11.4/11E146 - /usr/bin/xcodebuild Languages: Python: 2.7.16 - /usr/bin/python npmPackages: @react-native-community/cli: Not Found react: 16.11.0 => 16.11.0 react-native: 0.62.0 => 0.62.0 npmGlobalPackages: react-native: Not Found
Steps To Reproduce
- Created a new project with
react-native init
- Added a team on the XCode
- Opened the Flipper application
- Build using a real iPad as target device
Expected Results
Expected to run like on the simulator
Snack, code example, screenshot, or link to a repository:
About this issue
- Original URL
- State: closed
- Created 4 years ago
- Reactions: 24
- Comments: 27 (3 by maintainers)
As explained by @charway opening the
Pods.xcproj
project within the workspace, selecting each of theFlipper*
targets, and editing the “Valid Architectures” to removearmv7
andarmv7s
stops Xcode trying to build all the Flipper pods for actual devices. This gets overwritten every timepod install
is run, however, so instead adding the following to theflipper_post_install
section of thePodfile
will apply that change automatically on every install:Then since it’s no longer being built for those architectures, to stop importing/applying Flipper on actual devices edit your app’s
AppDelegate.m
file, replacing the#if DEBUG
macros with#if DEBUG && TARGET_OS_SIMULATOR
as below:The app should now build successfully for actual devices again (the log will show all the Flipper components were skipped).
im starting to move to flutter because react native start to contain so many issue with no fixed
if you use react-native-flipper, then you can solve it like this (disable auto-linking for ios react-native-flipper, linking manually for debugging only)
./react-native.config.js
./ios/Podfile
rm -rf ios/Pods/; cd ios; pod install; cd ..
Thank for the suggestion. Finally, I fixed it and successfully build and run with Xcode. 😄
For anyone who is facing the same issue with the react native version v0.62.0 or v0.62.1. Check this out!
v0.62.2
react-native-flipper
orflipper-plugin-rn-redux-inspector
just remove both of them.node_modules
andPods
npm install
(or yarn, if you use yarn) andcd ios && pod install
After trying these steps I still can’t build for generic device in debug configuration.
Try remove the “armv7” in VALID_ARCHS of Build Settings @jfbaraky
I’m wondering why this is not part of release 0.63.0? Now I have to patch my RN again…
@adamaveray thanks. I’ve build my app under iOS 13.1 succefuly. But build fails for iOS 10.3 with Library not found for “-lFlipper-DoubleConversion”, so I’ve modified flipper pod post install step:
@AlinDev, In AppDelegate.m the code should look like this, the only thing to replace is ‘#if DEBUG’ with ‘#if DEBUG && TARGET_OS_SIMULATOR’
Example: // …
#if DEBUG && TARGET_OS_SIMULATOR #import <FlipperKit/FlipperClient.h> #import <FlipperKitLayoutPlugin/FlipperKitLayoutPlugin.h> #import <FlipperKitUserDefaultsPlugin/FKUserDefaultsPlugin.h> #import <FlipperKitNetworkPlugin/FlipperKitNetworkPlugin.h> #import <SKIOSNetworkPlugin/SKIOSNetworkAdapter.h> #import <FlipperKitReactPlugin/FlipperKitReactPlugin.h>
static void InitializeFlipper(UIApplication *application) { FlipperClient *client = [FlipperClient sharedClient]; SKDescriptorMapper *layoutDescriptorMapper = [[SKDescriptorMapper alloc] initWithDefaults]; [client addPlugin:[[FlipperKitLayoutPlugin alloc] initWithRootNode:application withDescriptorMapper:layoutDescriptorMapper]]; [client addPlugin:[[FKUserDefaultsPlugin alloc] initWithSuiteName:nil]]; [client addPlugin:[FlipperKitReactPlugin new]]; [client addPlugin:[[FlipperKitNetworkPlugin alloc] initWithNetworkAdapter:[SKIOSNetworkAdapter new]]]; [client start]; } #endif
@implementation AppDelegate
// …
And in the podfile, just change the flipper version to: 0.49.1 & DoubleConversion to 1.1.7
I found another solution
In podfile, just make sure that the flipper & DoubleConversion versions are:
versions[‘Flipper’] ||= ‘> 0.49.1’ versions[‘DoubleConversion’] ||= ‘1.1.7’
And in the AppDelegate.m file just add: TARGET_OS_SIMULATOR to the flipper implementation in line 8, and in didFinishLaunchingWithOptions after the ‘#if DEBUG’
thats all, now the app will work on both real devices and simulators.
I have same problem, I update react-native-flipper and update Flipper in pods file to version 0.37.0 and have same problem, with I build Generic Device, but if I replace Generic device by other devices it’s working
and build success
can someone help me with this problem?
Just in case someone else is having the same problem as me… I was getting this same error simply because I forgot to edit the scheme in Xcode and switch to Release