简体   繁体   中英

How to properly add a third party framework to the ios part of a react-native project?

Hi I am quite new to react native and I'm trying to integrate a third party dynamic framework, SSZiparchive, but it doesn't work. I found conflicting awnsers online that suggested using use_modular_headers, instead of use_frameworks. in the pod file, but it doesn't work either way.
Here is my podfile:

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

platform :ios, '10.0'

target 'reactNative' do
  use_modular_headers!
  pod 'SSZipArchive'
  config = use_native_modules!
  
  use_react_native!(:path => config["reactNativePath"])

  # Enables Flipper.
  #
  # Note that if you have use_frameworks! enabled, Flipper will not work and
  # you should disable these next few lines.
  use_flipper!
  post_install do |installer|
    flipper_post_install(installer)
  end
end

target 'reactNative-tvOS' do
  # Pods for reactNative-tvOS

  target 'reactNative-tvOSTests' do
    inherit! :search_paths
    # Pods for testing
  end
end

After this not working i added this lines to the podfile from a solution online:

pod 'glog', :podspec => '../node_modules/react-native/third-party-podspecs/glog.podspec', :modular_headers => false
pod 'Folly', :podspec => '../node_modules/react-native/third-party-podspecs/Folly.podspec', :modular_headers => false

Now I'm getting the errors

Flipper-DoubleConversion.modulemap:1:8: Redefinition of module 'DoubleConversion'

and

stddef.h:102:10: Could not build module '_Builtin_stddef_max_align_t''

and

CoreFoundation.h:16:10: Could not build module 'Darwin'

Any ideas? Thanks

Try this solution as it is adding in pod file and run pod update. https://github.com/microsoft/react-native-code-push/issues/1123#issuecomment-354431939

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM