0

I do not use use_frameworks and use_native_modules in my podfile. It runs as usual when I enable use_native_modules, but build fail when I use use_frameworks.

I've read to understand what use_frameworks for but I'm not aware of the differences between this two.

platform :ios, '8.0'
use_frameworks!

target "CityWhether" do
    pod 'Alamofire'
    pod 'SwiftyJSON'
use_native_modules!
end
Tommy Leong
  • 2,509
  • 6
  • 30
  • 54
  • Did you read the below answer that you suggest? https://stackoverflow.com/a/49469205/10912727 It is saying you don't need to use use_frameworks anymore – Shing Ho Tan Mar 03 '20 at 02:33
  • Yes I read about it. However I'm still confused why adding it now in podfile will cause error since it's supported by default (Cocoapods 1.5.0 or above) – Tommy Leong Mar 03 '20 at 03:06

2 Answers2

3

Guess I have understand both the difference (please correct me if my understanding is incorrect),

For use_frameworks! please read here as it has already describe what it's for.

For use_native_modules!, it's actually being use in React Native 0.60 and above for auto-linking. With the command specified in podfile, all the new dependency appended to project do not require developer to append new dependency's podspec into podfile. It will link automatically when you run pod install command.

I have been appending all the podspecs myself ever since I upgraded to RN0.60

Sample podfile

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

Tommy Leong
  • 2,509
  • 6
  • 30
  • 54
-2

the header file search way maybe has been changed, so you can not build sucess