React-native: Undefined symbols for architecture arm64 - FlipperKitNetworkPlugin

Created on 10 Jul 2020  路  14Comments  路  Source: facebook/react-native

Description

After using the upgrade helper, in order to update to the last version of RN (0.63.0) I had some build errors related to Flipper.

Upgrade helper: https://react-native-community.github.io/upgrade-helper/?from=0.62.2&to=0.63.0

React Native version:

System:
    OS: macOS 10.15.5
    CPU: (12) x64 Intel(R) Core(TM) i7-8750H CPU @ 2.20GHz
    Memory: 1.12 GB / 16.00 GB
    Shell: 5.7.1 - /bin/zsh
  Binaries:
    Node: 12.16.1 - ~/.nvm/versions/node/v12.16.1/bin/node
    Yarn: 1.22.4 - /usr/local/bin/yarn
    npm: 6.13.4 - ~/.nvm/versions/node/v12.16.1/bin/npm
    Watchman: 4.9.0 - /usr/local/bin/watchman
  Managers:
    CocoaPods: 1.9.1 - /Users/barrosc/.rvm/gems/ruby-2.7.0/bin/pod
  SDKs:
    iOS SDK:
      Platforms: iOS 13.5, DriverKit 19.0, macOS 10.15, tvOS 13.4, watchOS 6.2
    Android SDK: Not Found
  IDEs:
    Android Studio: Not Found
    Xcode: 11.5/11E608c - /usr/bin/xcodebuild
  Languages:
    Java: 1.8.0_211 - /usr/bin/javac
    Python: 2.7.16 - /usr/bin/python
  npmPackages:
    @react-native-community/cli: Not Found
    react: 16.13.1 => 16.13.1 
    react-native: 0.63.0 => 0.63.0 

Steps To Reproduce

  1. ios folder: pod install
  2. root folder: react-native run-ios

Expected Results

Expected to build and successfully launch the app

Snack, code example, screenshot, or link to a repository:

Build Settings

Valid Architectures:
arm64 arm64e armv7 armv7s

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, '10.0'

target 'my_app' do
  config = use_native_modules!

  use_react_native!(:path => config["reactNativePath"])

  target 'app_tests' 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 these next few lines.
  use_flipper!
  post_install do |installer|
    flipper_post_install(installer)
    end
  end
end

Build Error
Screenshot 2020-07-10 at 18 29 10

iOS

Most helpful comment

Defining extra #if DEBUG above Flipper init code works for me

All 14 comments

Defining extra #if DEBUG above Flipper init code works for me

Same issue in my project for production builds. Can you guys please check?

@v-anton Which file should be modified for your workaround?

@v-anton Which file should be modified for your workaround?

AppDelegate.m

@v-anton

On the AppDelegate.m I already have this and is not enough:

 #ifdef FB_SONARKIT_ENABLED
    //Flipper
    InitializeFlipper(application);
 #endif

@v-anton Thanks, but I think this is the issue of latest [email protected] template anyway. I will use your workaround for now

Thanks @v-anton, I've used your workaround too. appDelegate.m needs to be updated to

#if DEBUG
#ifdef FB_SONARKIT_ENABLED
  InitializeFlipper(application);
#endif
#endif

Thanks @v-anton, I've used your workaround too. appDelegate.m needs to be updated to

#if DEBUG
#ifdef FB_SONARKIT_ENABLED
  InitializeFlipper(application);
#endif
#endif

This is a bit incorrect syntax, as my IDE shows an error here...

I confirm on RN 0.63.1 this worked for me and I don't have any alert from Xcode that it's incorrect syntax.

#if DEBUG
#ifdef FB_SONARKIT_ENABLED
  InitializeFlipper(application);
#endif
#endif

OK, thanks @mtt87

After migrate to RN 0.63.1 with the configuration below the error persists. On build settings, I have arm64, arm64e, armv7, armv7s architectures.

#if DEBUG
#ifdef FB_SONARKIT_ENABLED
  InitializeFlipper(application);
#endif
#endif

Other suggestions?

@carolinafbarros have you tried to clean build folder and rebuild from scratch?
I've also added

#if DEBUG
#ifdef FB_SONARKIT_ENABLED
#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
#endif

But not sure if it's related, a colleague didn't do it and it worked.

I have same architectures in build settings.

Those someone has problem with these process ? I try all yours solutions, but nothing work, I've always the same error...

Thank you, perfect

Was this page helpful?
0 / 5 - 0 ratings

Related issues

jlongster picture jlongster  路  3Comments

lazywei picture lazywei  路  3Comments

madwed picture madwed  路  3Comments

anchetaWern picture anchetaWern  路  3Comments

WG-Com picture WG-Com  路  3Comments