在RN開發(fā)中,ios會使用pod 安裝第三方庫
- 通過
pod init
自成 Podfile文件 - 打開文件加入相關內容如下
platform :ios, '8.0'
# The target name is most likely the name of your project.
target 'lgzq' do
# Your 'node_modules' directory is probably in the root of your project,
# but if not, adjust the `:path` accordingly
pod 'React', :path => '../node_modules/react-native', :subspecs => [
'Core',
'CxxBridge', # Include this for RN >= 0.47
'DevSupport', # Include this to enable In-App Devmenu if RN >= 0.43
'RCTText',
'RCTNetwork',
'RCTWebSocket', # needed for debugging
# Add any other subspecs you want to use in your project
]
# Explicitly include Yoga if you are using RN >= 0.42.0
pod 'yoga', :path => '../node_modules/react-native/ReactCommon/yoga'
# Third party deps podspec link
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'
pod 'react-native-amap-geolocation', path: '../node_modules/react-native-amap-geolocation/lib/ios'
end
- 執(zhí)行
pod install
拯辙,這個過程會等待比較長的時間 - 安裝后的工程不在使用
.xcodeproj
打開祟辟,而是.xcworkspace
奥帘,打開 - build后會在
../node_modules/react-native/
生成一個third-party
- 注意如果報
third-party
相關文件沒有找到繁调,這時清理工程,同時也要把third-party
刪除颗搂。否則一樣會報錯担猛。