1 安装CocoaPods
gem install cocoapods
2 安装nvm (see: its setup instructions here.)
3 安装nodejs
nvm install node && nvm alias default node
4 安装React Native
npm install react-native
5 使用CocoaPods集成React Native
修改Podfile,添加以下内容:
# Depending on how your project is organized,your node_modules directory may be
# somewhereelse;tell CocoaPods where you've installed react-native from npm
pod'React',:path=>'./node_modules/react-native',:subspecs=>[
'Core',
'RCTImage',
'RCTNetwork',
'RCTText',
'RCTWebSocket',
# Add any other subspecs you want to useinyour project
]
执行pod install命令进行集成
$ pod install
网友评论