Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

iosdfulibrary/iosdfulibrary-swift.h' file not found #13

Closed
dev-simpleplan opened this issue Nov 7, 2023 · 19 comments
Closed

iosdfulibrary/iosdfulibrary-swift.h' file not found #13

dev-simpleplan opened this issue Nov 7, 2023 · 19 comments

Comments

@dev-simpleplan
Copy link

I am facing some issues related to the IOSDFU library. How can we fix this issue?

279392577-1e4befd4-f0a9-4204-b3be-144fe4269885

@AshlandWest
Copy link

+1

1 similar comment
@andresev
Copy link

+1

@p4bl1t0
Copy link

p4bl1t0 commented Nov 13, 2023

Try with this: Pilloxa#171 (comment)

Works for me for building

@andresev
Copy link

@p4bl1t0 Yeah, I've tried his comment a few times but still get the error.

@Nickolans
Copy link

@andresev Also getting same error

@p4bl1t0
Copy link

p4bl1t0 commented Nov 13, 2023

Expo or React Native? Wich version?

@andresev
Copy link

I was able to get passed the iOSDFULibrary-swift.h file not found but now I'm getting 'iOSDFULibrary/iOSDFULibrary.modulemap not found'.

I am using React Native 72.3 @p4bl1t0

@andresev
Copy link

andresev commented Nov 14, 2023

Whoever is having this issue for iOSDFULibrary/iOSDFULibrary-swift.h file not found. Make sure to only have one pre_install in your pods. I had one for Mapbox but I ended up combining both of them into one pre_install.

pre_install do |installer|
  installer.pod_targets.each do |pod|
    if static_frameworks.include?(pod.name)
      puts "Overriding the static_frameworks? method for #{pod.name}"
      def pod.build_type;
        Pod::BuildType.new(:linkage => :static, :packaging => :framework)
      end
    end
  end
  $RNMapboxMaps.pre_install(installer)
end

@p4bl1t0
Copy link

p4bl1t0 commented Nov 14, 2023

I was not using anothe pre_install. This kind of configuration has to be put in the context of each app. Sometime is difficult beacause we're not really native developers (at least my case).

@andresev
Copy link

@p4bl1t0

We are using React Native and only using expo modules and I wonder if that's causing the issue? Do you have example from your pods or any project example with expo?

@p4bl1t0
Copy link

p4bl1t0 commented Nov 14, 2023

I'm on expo sdk 49 with prebuild. I'm using ble-plx module also.

@andresev
Copy link

I got it working. Expo just caused problems... Thanks for helping out.

@AshlandWest
Copy link

I am experiencing this issue on RN 0.72.6 and am not using expo.

@AshlandWest
Copy link

@andresev Which version of React Native are you running?
Also, would you mind sharing your Podfile so I can compare it to mine?

@andresev
Copy link

andresev commented Nov 17, 2023

@AshlandWest What error are you getting? I can help out with what I can. I've gotten so many errors. Share your Podfile. I'll show you the portion I added. The Podfile I have is long. Flipper is enabled. Make sure to only have one pre and post install. These are located inside

target 'App' do
...
 pod "react-native-nordic-dfu", path: "../node_modules/react-native-nordic-dfu"
...
 static_frameworks = ['iOSDFULibrary']
  pre_install do |installer|
    $RNMapboxMaps.pre_install(installer)
    installer.pod_targets.each do |pod|
      if static_frameworks.include?(pod.name)
        puts "Overriding the static_frameworks? method for #{pod.name}"
        def pod.build_type;
          Pod::BuildType.new(:linkage => :static, :packaging => :framework)
        end
      end
    end
  end
  ...

@AshlandWest
Copy link

Screenshot 2023-11-17 at 3 29 06 PM

@andresev I appreciate it. It's the same error you posted above. I am not using Flipper, but I guess I can turn it on if this library requires it to work.

def node_require(script)
  # Resolve script with node to allow for hoisting
  require Pod::Executable.execute_command('node', ['-p',
    "require.resolve(
      '#{script}',
      {paths: [process.argv[1]]},
    )", __dir__]).strip
end

node_require('react-native/scripts/react_native_pods.rb')
node_require('react-native-permissions/scripts/setup.rb')

platform :ios, min_ios_version_supported
prepare_react_native_project!

setup_permissions([
...
])

# 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 'PlayXTAC' do
  config = use_native_modules!

  # React Native Nordic DFU Setup
  pod "react-native-nordic-dfu", path: "../node_modules/react-native-nordic-dfu"

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

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

  post_install do |installer|
    # https://github.com/facebook/react-native/blob/main/packages/react-native/scripts/react_native_pods.rb#L197-L202
    react_native_post_install(
      installer,
      config[:reactNativePath],
      :mac_catalyst_enabled => false
    )
    __apply_Xcode_12_5_M1_post_install_workaround(installer)
  end
end

That's basically my full podfile, I just omitted the array inside setup_permissions because it's long and not relevant.

@andresev
Copy link

@AshlandWest I have pretty much the same setup except... whenever I got over the issue here. I'd say add this with the original Flipper setup. I added the following:

I have this right before the 'post_install'. I found this to be important and you'd see a change when doing a 'pod install'.

  static_frameworks = ['iOSDFULibrary']
  pre_install do |installer|
    installer.pod_targets.each do |pod|
      if static_frameworks.include?(pod.name)
        puts "Overriding the static_frameworks? method for #{pod.name}"
        def pod.build_type;
          Pod::BuildType.new(:linkage => :static, :packaging => :framework)
        end
      end
    end
  end

Also, when I did the one with no flipper, it just wouldn't work. So I left the original flipper configuration.

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

After this, you should see a change in your 'pod install' when adding the 'pre_install'. Make sure to delete your Pods folder, pod.lock, and then run 'pod install'. Also, very important, but in your case, you don't need to worry about it. Don't have two 'pre_install'. Just add the portion that's needed to the 'pre_install'. But based on the code you provided, it doesn't look like you have a 'pre_install' in there. Let me know how it goes!

@AshlandWest
Copy link

AshlandWest commented Nov 20, 2023

That worked!
Thank you so much!!!

@andresev
Copy link

@AshlandWest Awesome! Glad it worked!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants