XCode類のインストールと、サンプルの実行

いろいろ

一晩かかってもダウンロードできなかったXCodeが、よーやくダウンロードできた。オフィシャルのサイトは途中からのダウンロードのリジュームできないから、クラウドの端末でダウロードした後にOneDriveにコピーして、OneDriveからダウンロード。

XCodeインストール

Xcode_10.1.xipってファイルを展開して、アプリケーションフォルダにいれる。初期の起動もやってみて成功!

Command Line Toolsのインストール

こっちもダウンロードしたものをそのままインストールで成功!

ダメ元だったので、なんだうまく行っている感があってドキドキ。

サンプルプロジェクトの作成と実行

適当なディレクトリで作業

react-native init AwesomeProject

なんか、がしゃがしゃ動き出してreact-nativeインストールが始まった。どうなるかな。。途中、選択する状態になったので、HomeBrewの方を選択。

あれ?途中rubyらしき文言がなんども出てくる。へー。

……結構時間かかるのね。

あー、エラー出たわ。

checking for a BSD-compatible install… /usr/bin/install -c checking whether build environment is sane… yes checking for arm-apple-darwin-strip… no checking for strip… strip checking for a thread-safe mkdir -p… ./install-sh -c -d checking for gawk… no checking for mawk… no checking for nawk… no checking for awk… awk checking whether make sets $(MAKE)… yes checking whether make supports nested variables… yes checking for arm-apple-darwin-gcc… /Library/Developer/CommandLineTools/usr/bin/cc -arch armv7 -isysroot checking whether the C compiler works… no xcrun: error: SDK “iphoneos” cannot be located xcrun: error: SDK “iphoneos” cannot be located xcrun: error: SDK “iphoneos” cannot be located xcrun: error: unable to lookup item ‘Path’ in SDK ‘iphoneos’ /Users/daishiro/Library/Caches/CocoaPods/Pods/External/glog/2263bd123499e5b93b5efe24871be317-1f3da/missing: Unknown `–is-lightweight’ option Try `/Users/daishiro/Library/Caches/CocoaPods/Pods/External/glog/2263bd123499e5b93b5efe24871be317-1f3da/missing –help’ for more information configure: WARNING: ‘missing’ script is too old or missing configure: error: in `/Users/daishiro/Library/Caches/CocoaPods/Pods/External/glog/2263bd123499e5b93b5efe24871be317-1f3da’: configure: error: C compiler cannot create executables See `config.log’ for more details (node:47046) UnhandledPromiseRejectionWarning: Error: Failed to install CocoaPods dependencies for iOS project, which is required by this template. Please try again manually: “cd ./AwesomeProject/ios && pod install”. CocoaPods documentation: https://cocoapods.org/ at installPods (/Users/daishiro/AwesomeProject/node_modules/react-native/node_modules/@react-native-community/cli/build/tools/installPods.js:207:13) at processTicksAndRejections (internal/process/task_queues.js:97:5) (node:47046) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `–unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 3) (node:47046) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

太字のところやってみる。なんか、ごちゃごちゃ色々出て。

checking whether the C compiler works… no xcrun: error: SDK “iphoneos” cannot be located xcrun: error: SDK “iphoneos” cannot be located xcrun: error: SDK “iphoneos” cannot be located xcrun: error: unable to lookup item ‘Path’ in SDK ‘iphoneos’ /Users/daishiro/Library/Caches/CocoaPods/Pods/External/glog/2263bd123499e5b93b5efe24871be317-1f3da/missing: Unknown `–is-lightweight’ option Try `/Users/daishiro/Library/Caches/CocoaPods/Pods/External/glog/2263bd123499e5b93b5efe24871be317-1f3da/missing –help’ for more information configure: WARNING: ‘missing’ script is too old or missing configure: error: in `/Users/daishiro/Library/Caches/CocoaPods/Pods/External/glog/2263bd123499e5b93b5efe24871be317-1f3da’: configure: error: C compiler cannot create executables See `config.log’ for more details

だって。結局Cのコンパイラが必要なのかな。いや、エラーにはなってないから、どっちかというと「SDK “iphoneos” cannot be located」てのが問題っぽいな。

調べてみる。

(メモ)xcrunでsdkが見つからないエラーが出る場合の対処@Qiita, shouta-dev様

https://qiita.com/shouta-dev/items/a8e4914ec4d88cffac10

なんか、パスの問題っぽい?以下を実行してパスを通す。

sudo xcode-select –switch /Applications/Xcode.app/Contents/Developer/

そして、再度該当のディレクトリで以下コマンドでインストール。

$ pod install Analyzing dependencies Fetching podspec for `DoubleConversion` from `../node_modules/react-native/third-party-podspecs/DoubleConversion.podspec` Fetching podspec for `Folly` from `../node_modules/react-native/third-party-podspecs/Folly.podspec` Fetching podspec for `glog` from `../node_modules/react-native/third-party-podspecs/glog.podspec` Downloading dependencies Installing DoubleConversion (1.1.6) Installing FBLazyVector (0.61.5) Installing FBReactNativeSpec (0.61.5) Installing Folly (2018.10.22.00) Installing RCTRequired (0.61.5) Installing RCTTypeSafety (0.61.5) Installing React (0.61.5) Installing React-Core (0.61.5) Installing React-CoreModules (0.61.5) Installing React-RCTActionSheet (0.61.5) Installing React-RCTAnimation (0.61.5) Installing React-RCTBlob (0.61.5) Installing React-RCTImage (0.61.5) Installing React-RCTLinking (0.61.5) Installing React-RCTNetwork (0.61.5) Installing React-RCTSettings (0.61.5) Installing React-RCTText (0.61.5) Installing React-RCTVibration (0.61.5) Installing React-cxxreact (0.61.5) Installing React-jsi (0.61.5) Installing React-jsiexecutor (0.61.5) Installing React-jsinspector (0.61.5) Installing ReactCommon (0.61.5) Installing Yoga (1.14.0) Installing boost-for-react-native (1.63.0) Installing glog (0.3.5) Generating Pods project Integrating client project [!] Please close any current Xcode sessions and use `AwesomeProject.xcworkspace` for this project from now on. Pod installation complete! There are 28 dependencies from the Podfile and 26 total pods installed.

おー、なんかうまくいったっぽい!

サンプルを実行してみる

プロジェクトディレクトリで、以下のコマンドを実行。

react-native run-ios info Found Xcode workspace “AwesomeProject.xcworkspace” info Launching iPhone X (iOS 12.1) info Building (using “xcodebuild -workspace AwesomeProject.xcworkspace -configuration Debug -scheme AwesomeProject -destination id=D82DC4D8-796F-4199-8EE1-F220A239395A”) ………….

おおお!なんかエミュレータが立ち上がった!!!

エミュレータの画面

すげー!嬉しい!

そして、 案の定、超重い!!!!

でもよしとする!

これが実機で動いたら嬉しいなぁ。とりあえずここまで!

サンプルプロジェクトが勝手に実行されたとこ
タイトルとURLをコピーしました