-11.4 C
New York
Tuesday, January 21, 2025

ios – Unable to hyperlink a swift framework to a expo native module. Compiler can not discover header information


I’ve an Expo app which goes to speak with a bluetooth system. The producer of the system have given me a SDK as a swift framework. Let’s name it CustomBluetoothModule.framework. I haven’t got it is supply code. It have a pre constructed binary. The framework’s folder even have an umbrella file with some header information in it. I am attempting to put in writing a wrapper round this Framework utilizing an expo native module in order that I can use this within the React Native code. The issue is, as quickly as I place the framework contained in the native module, it provides me compile time errors saying the header information are lacking:

› Executing expo-web-browser Pods/ExpoWebBrowser » Copy generated compatibility header
› Executing native-module-test Pods/TestLocalModule » Copy generated compatibility header
› Compiling Pods/Pods-nativemoduletest » Pods-nativemoduletest-dummy.m
› Packaging Pods/Pods-nativemoduletest » libPods-nativemoduletest.a
› Executing nativemoduletest » [CP] Test Pods Manifest.lock
› Executing nativemoduletest » [Expo] Configure undertaking
› Copying   ./PrivacyInfo.xcprivacy ➜ ios/nativemoduletest/PrivacyInfo.xcprivacy
› Copying   ios/nativemoduletest/Supporting/Expo.plist ➜ ./Expo.plist
› Compiling nativemoduletest » SplashScreen.storyboard

❌  (/Customers/pubudu/Library/Developer/Xcode/DerivedData/nativemoduletest-denbynqwuqfmebgdbtkenakcxmew/Construct/Merchandise/Debug-iphoneos/TestLocalModule/TestLocalModule-umbrella.h:13:9)

  11 | #endif
  12 |
> 13 | #import "CustomBluetoothModule-umbrella.h"
     |         ^ 'CustomBluetoothModule-umbrella.h' file not discovered
  14 | #import "CustomBluetoothModuleDevice.h"
  15 |
  16 | FOUNDATION_EXPORT double TestLocalModuleVersionNumber;


❌  (/Customers/pubudu/Library/Developer/Xcode/DerivedData/nativemoduletest-denbynqwuqfmebgdbtkenakcxmew/Construct/Merchandise/Debug-iphoneos/TestLocalModule/TestLocalModule-umbrella.h:13:9)

  11 | #endif
  12 |
> 13 | #import "CustomBluetoothModule-umbrella.h"
     |         ^ 'CustomBluetoothModule-umbrella.h' file not discovered
  14 | #import "CustomBluetoothModuleDevice.h"
  15 |
  16 | FOUNDATION_EXPORT double TestLocalModuleVersionNumber;

The folder construction of the undertaking is as follows:
enter image description here

As you may see, there is a CustomBluetoothModuleDevice.h file which has been imported in CustomBluetoothModule-umbrella.h. The content material of the CustomBluetoothModule-umbrella.h file is as follows:

#import "CustomBluetoothModuleDevice.h"

I created minimal reproducable instance right here: https://github.com/THPubs/native-module-test
In there, attempting to run npx expo run:ios --device will give the above error. Please assist me repair this. I am not a lot aware of Swift.

My TestLocalModule.podspec:

Pod::Spec.new do |s|
  s.title="TestLocalModule"
  s.model        = '1.0.0'
  s.abstract        = 'A pattern undertaking abstract'
  s.description    = 'A pattern undertaking description'
  s.writer=""
  s.homepage="https://docs.expo.dev/modules/"
  s.platforms      = {
    :ios => '15.1',
    :tvos => '15.1'
  }
  s.supply         = { git: '' }
  s.static_framework = true

  s.dependency 'ExpoModulesCore'

  # Swift/Goal-C compatibility
  s.pod_target_xcconfig = {
    'DEFINES_MODULE' => 'YES',
  }

  s.source_files = "**/*.{h,m,mm,swift,hpp,cpp}"
  s.vendored_frameworks="CustomBluetoothModule.framework"
finish

Related Articles

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Latest Articles