react-native-share-menu icon indicating copy to clipboard operation
react-native-share-menu copied to clipboard

Build failed on the RN 0.71.3 [IOS]

Open BohdanPylypchuk opened this issue 2 years ago • 8 comments

react-native: 0.71.3 react-native-share-menu: 6.0.0

Can't build an ios app on the react-native 0.71.3

Build error:

Undefined symbols for architecture arm64:
  "_OBJC_CLASS_$_FKUserDefaultsPlugin", referenced from:
      objc-class-ref in libReact-Core.a(RCTAppSetupUtils.o)
  "_OBJC_CLASS_$_FlipperClient", referenced from:
      objc-class-ref in libReact-Core.a(RCTAppSetupUtils.o)
  "_OBJC_CLASS_$_FlipperKitLayoutPlugin", referenced from:
      objc-class-ref in libReact-Core.a(RCTAppSetupUtils.o)
  "_OBJC_CLASS_$_FlipperKitNetworkPlugin", referenced from:
      objc-class-ref in libReact-Core.a(RCTAppSetupUtils.o)
  "_OBJC_CLASS_$_FlipperKitReactPlugin", referenced from:
      objc-class-ref in libReact-Core.a(RCTAppSetupUtils.o)
  "_OBJC_CLASS_$_SKDescriptorMapper", referenced from:
      objc-class-ref in libReact-Core.a(RCTAppSetupUtils.o)
  "_OBJC_CLASS_$_SKIOSNetworkAdapter", referenced from:
      objc-class-ref in libReact-Core.a(RCTAppSetupUtils.o)
ld: symbol(s) not found for architecture arm64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
image

BohdanPylypchuk avatar Mar 07 '23 14:03 BohdanPylypchuk

Try adding flipper_configuration to the use_react_native in the share extension target of your pod file

target 'ShareExtension' do
  use_react_native!(:flipper_configuration => flipper_config)

scottnash avatar Mar 08 '23 20:03 scottnash

@scottnash doesn't work for me. Can you maybe share your complete Podfile? Maybe I am missing something. Thanks

karuzo17 avatar Mar 10 '23 09:03 karuzo17

@karuzo17 did you remember to rerun pod install after making the change?

scottnash avatar Mar 10 '23 11:03 scottnash

I fixed this error by adding this to my target 'share_extension_name' do

  config = use_native_modules!

  # use_frameworks! :linkage => podfile_properties['ios.useFrameworks'].to_sym if podfile_properties['ios.useFrameworks']
  # use_frameworks! :linkage => ENV['USE_FRAMEWORKS'].to_sym if ENV['USE_FRAMEWORKS']

  # Flags change depending on the env values.
  flags = get_default_flags()
  use_react_native!(
    :path => config[:reactNativePath],
    :hermes_enabled => podfile_properties['expo.jsEngine'] == nil || podfile_properties['expo.jsEngine'] == 'hermes',
    :fabric_enabled => flags[:fabric_enabled],
    # An absolute path to your application root.
    :app_path => "#{Pod::Config.instance.installation_root}/..",
    # Note that if you have use_frameworks! enabled, Flipper will not work if enabled
    # :flipper_configuration => flipper_config
    :flipper_configuration => !ENV['CI'] ? FlipperConfiguration.enabled(["Debug"], { 'Flipper' => '0.184.0' }) : FlipperConfiguration.disabled,
  )

For anyone who maybe meet this problem too.

dongsuo avatar Jul 10 '23 16:07 dongsuo

react-native: 0.72.1 react-native-share-menu: 6.0.0

Can't build an ios app on the react-native 0.72.1

Build error:

Undefined symbols for architecture arm64:
  "_OBJC_CLASS_$_FKUserDefaultsPlugin", referenced from:
      objc-class-ref in libReact-Core.a(RCTAppSetupUtils.o)
  "_OBJC_CLASS_$_FlipperClient", referenced from:
      objc-class-ref in libReact-Core.a(RCTAppSetupUtils.o)
  "_OBJC_CLASS_$_FlipperKitLayoutPlugin", referenced from:
      objc-class-ref in libReact-Core.a(RCTAppSetupUtils.o)
  "_OBJC_CLASS_$_FlipperKitNetworkPlugin", referenced from:
      objc-class-ref in libReact-Core.a(RCTAppSetupUtils.o)
  "_OBJC_CLASS_$_FlipperKitReactPlugin", referenced from:
      objc-class-ref in libReact-Core.a(RCTAppSetupUtils.o)
  "_OBJC_CLASS_$_SKDescriptorMapper", referenced from:
      objc-class-ref in libReact-Core.a(RCTAppSetupUtils.o)
  "_OBJC_CLASS_$_SKIOSNetworkAdapter", referenced from:
      objc-class-ref in libReact-Core.a(RCTAppSetupUtils.o)
ld: symbol(s) not found for architecture arm64
clang: error: linker command failed with exit code 1 (use -v to see invocation)

I have fixed this error by adding this to my target 'share_extension_name' do

target 'share_extension_name' do
  use_react_native!(
    :hermes_enabled => true,
    :flipper_configuration => flipper_config,
  )

  pod 'RNShareMenu', :path => '../node_modules/react-native-share-menu'
  # Manually link packages here to keep your extension bundle size minimal
end

asadraza4522 avatar Jul 20 '23 16:07 asadraza4522

Try adding flipper_configuration to the use_react_native in the share extension target of your pod file

target 'ShareExtension' do
  use_react_native!(:flipper_configuration => flipper_config)

That fixed it for me on RN 0.72.4

zabojad avatar Oct 19 '23 14:10 zabojad

Try adding flipper_configuration to the use_react_native in the share extension target of your pod file

target 'ShareExtension' do
  use_react_native!(:flipper_configuration => flipper_config)

This seemed to help me as well

allenjhyang avatar Nov 03 '23 01:11 allenjhyang

Try adding flipper_configuration to the use_react_native in the share extension target of your pod file

target 'ShareExtension' do
  use_react_native!(:flipper_configuration => flipper_config)

This worked for me as well 👍 Can we update the instructions? :D https://github.com/Expensify/react-native-share-menu/pull/310

gbyesiltas avatar Mar 16 '24 21:03 gbyesiltas