Particle-Network / particle-react-native

Apache License 2.0
12 stars 7 forks source link

Build Errors in Expo Bare Workflow with Particle React Native Integration #3

Closed sudojanuc closed 1 year ago

sudojanuc commented 1 year ago

Hello,

I hope this message finds you well. I am currently facing some build errors in my Expo bare workflow project after integrating Particle React Native. I encounter the following errors during the build process:

^ underlying Objective-C module 'EXDevMenuInterface' not found

 ^ failed to verify module interface of 'EXDevMenuInterface' due to the errors above; the textual interface may be broken by project issues or a compiler bug

 ^ underlying Objective-C module 'EXDevMenuInterface' not found

 ^ failed to verify module interface of 'EXDevMenuInterface' due to the errors above; the textual interface may be broken by project issues or a compiler bug

Upon investigating further, I noticed that these errors seem to be related to a change in the Podfile. The problematic code snippet in question is as follows:

   installer.pods_project.targets.each do |target|
      target.build_configurations.each do |config|
      config.build_settings['BUILD_LIBRARY_FOR_DISTRIBUTION'] = 'YES'
        end
    end

It appears that the Expo Dev Client may not be compatible with building for distribution, which could be causing this issue. Interestingly, removing these lines of code results in similar errors involving modules like "cryptoswift."

I would greatly appreciate any assistance in resolving this problem. If there are any alternative solutions or workarounds, I would be eager to try them out. Thank you very much for your time and support.

Best regards, Jan

SunZhiC commented 1 year ago

Our SDKs are XCFrameworks, should be set BUILD_LIBRARY_FOR_DISTRIBUTION = YES. You can try to edit the Podfile

 installer.pods_project.targets.each do |target|
      target.build_configurations.each do |config|
// add some code, determine whether the names are the same
// specify ParticleAuthService, ParticleNetworkBase ... and all ParticleSDK 
      config.build_settings['BUILD_LIBRARY_FOR_DISTRIBUTION'] = 'YES'
        end
    end
SunZhiC commented 1 year ago

This is an example for react-native-particle-auth. for other package, you can add our SDK and sub modules more in the same way.

post_install do |installer|
    installer.pods_project.targets.each do |target|
      if target.name == 'ParticleNetworkBase' or 
         target.name == 'ParticleAuthService' or 
         target.name == 'CryptoSwift' or 
         target.name == 'SwiftyUserDefaults'
         target.build_configurations.each do |config|
              config.build_settings['BUILD_LIBRARY_FOR_DISTRIBUTION'] = 'YES'
      end
  end
end