facebook / flipper

A desktop debugging platform for mobile developers.
https://fbflipper.com/
MIT License
13.31k stars 954 forks source link

Multiples erros in archive iOS in new version react native 0.71.2 #4494

Open alexanderiscoding opened 1 year ago

alexanderiscoding commented 1 year ago

πŸ› Bug Report

https://imgur.com/eDP7k2i

To Reproduce

npx react-native init AwesomeProject

react-native bundle --entry-file index.js --platform ios --dev false --bundle-output ios/main.jsbundle --assets-dest ios cd ios pod install

open xcode and build after archive

Environment

errors:

Undefined symbol: _OBJC_CLASS_$_FKUserDefaultsPlugin Undefined symbol: _OBJC_CLASS_$_FlipperClient Undefined symbol: _OBJC_CLASS_$_FlipperKitLayoutPlugin Undefined symbol: _OBJC_CLASS_$_FlipperKitNetworkPlugin Undefined symbol: _OBJC_CLASS_$_FlipperKitReactPlugin Undefined symbol: _OBJC_CLASS_$_SKDescriptorMapper Undefined symbol: _OBJC_CLASS_$_SKIOSNetworkAdapter

System: OS: macOS 13.0.1 CPU: (4) x64 Intel(R) Core(TM) i5-7400 CPU @ 3.00GHz Memory: 1.70 GB / 8.00 GB Shell: 5.8.1 - /bin/zsh Binaries: Node: 16.17.1 - /usr/local/bin/node Yarn: 1.22.19 - /usr/local/bin/yarn npm: 9.2.0 - /usr/local/bin/npm Watchman: 2022.10.03.00 - /usr/local/bin/watchman Managers: CocoaPods: 1.11.3 - /usr/local/bin/pod SDKs: iOS SDK: Platforms: DriverKit 22.2, iOS 16.2, macOS 13.1, tvOS 16.1, watchOS 9.1 Android SDK: Not Found IDEs: Android Studio: Not Found Xcode: 14.2/14C18 - /usr/bin/xcodebuild Languages: Java: 1.8.0_221 - /usr/bin/javac npmPackages: @react-native-community/cli: Not Found react: 18.2.0 => 18.2.0 react-native: ^0.71.2 => 0.71.2 react-native-macos: Not Found npmGlobalPackages: react-native: Not Found

sarafhbk commented 1 year ago

is there any solution for this? facing the above issue while building the ios app after upgrading the rn version to 0.71.2.

This is how my podfile looks like.

require_relative '../node_modules/react-native/scripts/react_native_pods'
require_relative '../node_modules/@react-native-community/cli-platform-ios/native_modules'

platform :ios, min_ios_version_supported
prepare_react_native_project!

project 'AppName',
  'Debug' => :debug,
  'Release' => :release,
  'Production.Debug' => :debug,
  'Production.Release' => :release,
  'Development.Debug' => :debug,
  'Development.Release' => :release,
  'QA.Debug' => :debug,
  'QA.Release' => :release

# If you are using a `react-native-flipper` your iOS build will fail when `NO_FLIPPER=1` is set.
# because `react-native-flipper` depends on (FlipperKit,...) that will be excluded
#
# To fix this you can also exclude `react-native-flipper` using a `react-native.config.js`
# ```js
# module.exports = {
#   dependencies: {
#     ...(process.env.NO_FLIPPER ? { 'react-native-flipper': { platforms: { ios: null } } } : {}),
# ```
flipper_config = ENV['NO_FLIPPER'] == "1" ? FlipperConfiguration.disabled : FlipperConfiguration.enabled

linkage = ENV['USE_FRAMEWORKS']
if linkage != nil
  Pod::UI.puts "Configuring Pod with #{linkage}ally linked Frameworks".green
  use_frameworks! :linkage => linkage.to_sym
end

target 'AppName' do
  config = use_native_modules!

  # Flags change depending on the env values.
  flags = get_default_flags()

  use_react_native!(
    :path => config[:reactNativePath],
    # Hermes is now enabled by default. Disable by setting this flag to false.
    # Upcoming versions of React Native may rely on get_default_flags(), but
    # we make it explicit here to aid in the React Native upgrade process.
    :hermes_enabled => flags[:hermes_enabled],
    :fabric_enabled => flags[:fabric_enabled],
    # Enables Flipper.
    #
    # Note that if you have use_frameworks! enabled, Flipper will not work and
    # you should disable the next line.
    :flipper_configuration => flipper_config,
    # An absolute path to your application root.
    :app_path => "#{Pod::Config.instance.installation_root}/.."
  )

  target 'AppNameTests' do
    inherit! :complete
    # Pods for testing
  end

  post_install do |installer|
    react_native_post_install(
      installer,
      # Set `mac_catalyst_enabled` to `true` in order to apply patches
      # necessary for Mac Catalyst builds
      :mac_catalyst_enabled => false
    )
    __apply_Xcode_12_5_M1_post_install_workaround(installer)
  end
end
t0nyh0 commented 1 year ago

We are experiencing similar issues but with Apple Silicon

SohaibKtb commented 1 year ago

+1

TheWirv commented 1 year ago

4278 #4457

padabala commented 1 year ago

I have multiple schemes with debug and release build configurations.

project 'SampleProject',
        'Dev Debug' => :debug,
        'Dev Release' => :release,
        'Beta Debug' => :debug,
        'Beta Release' => :release,
        'Prod Debug' => :debug,
        'Prod Release' => :release

Then added the following line with those schemes build configuration names to Podfile resolved issues.

:flipper_configuration => FlipperConfiguration.enabled(["Dev Debug", "Beta Debug", "Prod Debug"])

And connecting to a debugger also started working by disabling Hermes in Podfile as follows.

:hermes_enabled => flags[:hermes_enabled => false]

React-Native: 0.71.3 Xcode: 14.2

kashee-lv commented 1 year ago

I am also facing the same issue

AlexSobiloffSonos commented 1 year ago

We were having the same issue. Ultimately, it came down to excluding flipper et al from release builds.

RN 0.71.1

# podfile

flipper_config = ENV['NO_FLIPPER'] == "1" ? FlipperConfiguration.disabled : FlipperConfiguration.enabled

...

target 'myapp' do
  # Flags change depending on the env values.
  flags = get_default_flags()

  use_react_native!(
    ...

    # Enables Flipper.
    #
    # Note that if you have use_frameworks! enabled, Flipper will not work and
    # you should disable the next line.
    :flipper_configuration => flipper_config,

    ...
    )
  ...
end
// react-native.config.js
module.exports = {
  dependencies: {
    ...(process.env.NO_FLIPPER // When set, skip flipper includes for iOS archive builds (release buidls)
      ? { 'react-native-flipper': { platforms: { ios: null } } }
      : {}),
  },
  // ...
};

then to build for debug locally, in /ios you must first run NO_FLIPPER=0 arch -x86_64 pod install NO_FLIPPER is the env var arch -x86_64 because we're on m1 pod install because why else are we here?

in your build CI, add the NO_FLIPPER=1 env var. before running pod install. this will remove all flipper nonsense from your build decreasing your build time by 10+ minutes and preventing the nasty errors you're seeing above.

fukemy commented 1 year ago

any solution now?

susonthapa commented 1 year ago

+1