概要
react-native init <project name>
をした後に、
react-native run-ios
を実行すると、
error Could not find "Podfile.lock" at .....
のエラーが出た時の対処法。
##解決コマンド
1 - cocoapods をインストールする
sudo gem install cocoapods
2 - 以下のコマンドを実行
cd ios && pod install && cd ../ && react-native run-ios
3 - もし上のコマンドで、pod install にエラーが出る場合、以下を実行
xcrun -k --sdk iphoneos --show-sdk-path
4 - この時にもし以下のエラーが出る場合
xcrun:_ error: SDK "iphoneos" cannot be located
xcrun: error: SDK "iphoneos" cannot be located
xcrun: error: unable to lookup item 'Path' in SDK 'iphoneos'
5 - この場合は以下のコマンドを実行し、2のpod install コマンドを再度実行する。
sudo xcode-select --switch /Applications/Xcode.app
以上で
react-native run-ios
で無事エミュレータを起動することができた。
おわり。