react-native-line: 'RNLine-Swift.h' file not found

Your environment

You can run (react-native -v) to obtain info and paste it below:

  • React: 18.2.0
  • React Native: 0.71.8
  • React Native Line: ^2.2.0

Description

In AppDelegate.mm, I can’t import “RNLine-Swift.h” I moved to top, and the problem is not solved

Screenshots

image

About this issue

  • Original URL
  • State: closed
  • Created a year ago
  • Reactions: 5
  • Comments: 42 (3 by maintainers)

Most upvoted comments

@tranquockhanh0506 Yes, absolutely you are right…Thank you very much anyway.

add: use_frameworks! :linkage => :static

  installer.pods_project.build_configurations.each do |config|
  config.build_settings["CLANG_ALLOW_NON_MODULAR_INCLUDES_IN_FRAMEWORK_MODULES"] = true
end

in your pod file.

Same issue

Hey @najil-12 ! Sure, this is the file:

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

platform :ios, '12.4'
install! 'cocoapods', :deterministic_uuids => false

target 'RNLineExample' do
  config = use_native_modules!
  use_frameworks! :linkage => :static

  # 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 => true,
    :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 => FlipperConfiguration.enabled,
    # An absolute path to your application root.
    :app_path => "#{Pod::Config.instance.installation_root}/.."
  )

  target 'RNLineExampleTests' 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
    )
    # NOTE: Change IPHONEOS_DEPLOYMENT_TARGET to 12.4.
    installer.pods_project.targets.each do |target|
      target.build_configurations.each do |config|
        config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'] = '12.4'
      end
    end
    __apply_Xcode_12_5_M1_post_install_workaround(installer)
  end
end

It should be almost the same as the one created when starting a new project with npx react-native ....

I see that you’re encountering the same issue as posted in #108. Can you provide your pod installation result?

Hey @purrsong-chong, how are you?

It’s possible that the issue could be related to the installation of pods and the generation of the bridging file for Objective-C and Swift. I recommend trying the following steps:

  1. Open a terminal and navigate to your project’s root directory.
  2. Run the command yarn to ensure that all dependencies are up to date.
  3. Change directory to the iOS folder using the command cd ios.
  4. Run pod install to install the necessary pods for your project.
  5. After the installation completes, try rebuilding your project.

If the problem persists, you can also try cleaning and rebuilding your project within Xcode:

  1. Open Xcode and go to the “Product” menu.
  2. Select “Clean” to clean your project.
  3. Once the cleaning process finishes, select “Build” to rebuild your project.

Sometimes, Xcode may not recognize changes immediately, so cleaning and rebuilding the project can help in such cases.

I hope these suggestions help you resolve the issue. If you have any further questions or encounter any additional problems, please let me know!