use_framework vs use_native_modules - PullRequest
       5

use_framework vs use_native_modules

0 голосов
/ 03 марта 2020

Я не использую use_frameworks и use_native_modules в моем подфайле. Он работает как обычно, когда я включаю use_native_modules, но сборка завершается неудачно, когда я использую use_frameworks.

Я прочитал , чтобы понять для чего use_frameworks, но я не в курсе из различий между этими двумя.

platform :ios, '8.0'
use_frameworks!

target "CityWhether" do
    pod 'Alamofire'
    pod 'SwiftyJSON'
use_native_modules!
end

Ответы [ 2 ]

1 голос
/ 04 марта 2020

Думаю, я понимаю разницу (пожалуйста, поправьте меня, если мое понимание неверно),

Для use_frameworks ! пожалуйста, прочитайте здесь , поскольку он уже описал, для чего он.

Для use_native_modules !, фактически он используется в React Native 0.60 и выше для автоматической привязки. С помощью команды, указанной в подфайле, все новые зависимости, добавленные в проект, не требуют от разработчика добавления нового поддиапазона зависимости c в подфайл. Он будет автоматически связываться при запуске команды pod install.

Я сам добавлял все подспецификации с тех пор, как обновился до RN0.60 ?

Пример подфайла

platform :ios, '9.0'
require_relative '../node_modules/@react-native-community/cli-platform-ios/native_modules'

target 'example' do
  # Pods for example
  pod 'FBLazyVector', :path => "../node_modules/react-native/Libraries/FBLazyVector"
  pod 'FBReactNativeSpec', :path => "../node_modules/react-native/Libraries/FBReactNativeSpec"
  pod 'RCTRequired', :path => "../node_modules/react-native/Libraries/RCTRequired"
  pod 'RCTTypeSafety', :path => "../node_modules/react-native/Libraries/TypeSafety"
  pod 'React', :path => '../node_modules/react-native/'
  pod 'React-Core', :path => '../node_modules/react-native/'
  pod 'React-CoreModules', :path => '../node_modules/react-native/React/CoreModules'
  pod 'React-Core/DevSupport', :path => '../node_modules/react-native/'
  pod 'React-RCTActionSheet', :path => '../node_modules/react-native/Libraries/ActionSheetIOS'
  pod 'React-RCTAnimation', :path => '../node_modules/react-native/Libraries/NativeAnimation'
  pod 'React-RCTBlob', :path => '../node_modules/react-native/Libraries/Blob'
  pod 'React-RCTImage', :path => '../node_modules/react-native/Libraries/Image'
  pod 'React-RCTLinking', :path => '../node_modules/react-native/Libraries/LinkingIOS'
  pod 'React-RCTNetwork', :path => '../node_modules/react-native/Libraries/Network'
  pod 'React-RCTSettings', :path => '../node_modules/react-native/Libraries/Settings'
  pod 'React-RCTText', :path => '../node_modules/react-native/Libraries/Text'
  pod 'React-RCTVibration', :path => '../node_modules/react-native/Libraries/Vibration'
  pod 'React-Core/RCTWebSocket', :path => '../node_modules/react-native/'

  pod 'React-cxxreact', :path => '../node_modules/react-native/ReactCommon/cxxreact'
  pod 'React-jsi', :path => '../node_modules/react-native/ReactCommon/jsi'
  pod 'React-jsiexecutor', :path => '../node_modules/react-native/ReactCommon/jsiexecutor'
  pod 'React-jsinspector', :path => '../node_modules/react-native/ReactCommon/jsinspector'
  pod 'ReactCommon/jscallinvoker', :path => "../node_modules/react-native/ReactCommon"
  pod 'ReactCommon/turbomodule/core', :path => "../node_modules/react-native/ReactCommon"
  pod 'Yoga', :path => '../node_modules/react-native/ReactCommon/yoga'

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

  target 'exampleTests' do
    inherit! :search_paths
    # Pods for testing
  end

  use_native_modules!
end

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

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

end

0 голосов
/ 03 марта 2020

способ поиска файла заголовка, возможно, был изменен, поэтому вы не можете построить успех

...