question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Undefined symbol on Flipper using 0.62 on real iOS device

See original GitHub issue

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

  1. Created a new project with react-native init
  2. Added a team on the XCode
  3. Opened the Flipper application
  4. 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:

image

Issue Analytics

  • State:open
  • Created 3 years ago
  • Reactions:24
  • Comments:25 (1 by maintainers)

github_iconTop GitHub Comments

57reactions
adamaveraycommented, Mar 30, 2020

As explained by @charway opening the Pods.xcproj project within the workspace, selecting each of the Flipper* targets, and editing the “Valid Architectures” to remove armv7 and armv7s stops Xcode trying to build all the Flipper pods for actual devices. This gets overwritten every time pod install is run, however, so instead adding the following to the flipper_post_install section of the Podfile will apply that change automatically on every install:

# Post Install processing for Flipper
def flipper_post_install(installer)
  installer.pods_project.targets.each do |target|
    if target.name == 'YogaKit'
      target.build_configurations.each do |config|
        config.build_settings['SWIFT_VERSION'] = '4.1'
      end
    end

    # Enable Flipper for simulators only
    if target.name.start_with?('Flipper')
      target.build_configurations.each do |config|
        config.build_settings['VALID_ARCHS'] = 'arm64 arm64e'
      end
    end
  end
end

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:

// ...

#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

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
#if DEBUG && TARGET_OS_SIMULATOR
  InitializeFlipper(application);
#endif

// ...

The app should now build successfully for actual devices again (the log will show all the Flipper components were skipped).

19reactions
samerdernaikacommented, Nov 5, 2020

im starting to move to flutter because react native start to contain so many issue with no fixed

Read more comments on GitHub >

github_iconTop Results From Across the Web

react-native iOS new scheme error: Undefined symbol
In my case I updated to react native: 0.70.* and Flipper to version 174 and had this error. Downgrading Flipper to 163 fixed...
Read more >
undefined symbol: _sdimagecoderencodecompressionquality ...
This error is usually caused by a missing symbol in the linker settings when building an iOS application. The symbol _sdimagecoderencodecompressionquality is ...
Read more >
React Native App - Automatic Setup - Flipper
Starting with React Native 0.62, after generating your project with react-native init, ... iOS - run pod install once in the ios directory...
Read more >
Swift linker error: Undefined symb… | Apple Developer Forums
Undefined symbol : (extension in CoreMedia):__C.CMFormatDescriptionRef.presentationDimensions(usePixelAspectRatio: Swift.Bool, useCleanAperture: Swift.
Read more >
React Native with Go Mobile on Mac Catalyst - Daniel Wiese
During WWDC 2019 Mac Catalyst was announced allowing iOS apps to be built ... at the time in React Native 0.62.0, to build...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found