console.log: Rise of React Native

Following previous article, console.log, if we run yarn ios on rnw-github directory, we’ll got following error:

➜ rnw-github git:(master) βœ— yarn ios
yarn run v1.12.1
$ react-native run-ios
Scanning folders for symlinks in /Users/haruelrovix/Projects/rnw-github/node_modules (49ms)
Found Xcode project creaternwapp.xcodeproj
xcrun: error: unable to find utility “instruments”, not a developer tool or in PATH

Command failed: xcrun instruments -s
xcrun: error: unable to find utility “instruments”, not a developer tool or in PATH

error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

To fix that, follow guidance from dev’s God of Answer, Stack Overflow:

In Xcode, select Xcode menu, then Preferences, then Locations tab. Select your Xcode version from the dropdown and exit Xcode.

Wait a minute… There is no Xcode installed, yet. πŸ€£

Tried to install latest Xcode, current macOS (Sierra) doesn’t support it. πŸ™„ There is no other way then. Let’s upgrade it to Mojave!

2 days later…

Mojave βœ…

Xcode βœ…

Run yarn ios again:

➜ rnw-github yarn ios
yarn run v1.12.1
$ react-native run-ios
Scanning folders for symlinks in /Users/haruelrovix/Projects/rnw-github/node_modules (67ms)
Found Xcode project creaternwapp.xcodeproj

Agreeing to the Xcode/iOS license requires admin privileges, please run β€œsudo xcodebuild -license” and then retry this command.

Command failed: xcrun instruments -s

Agreeing to the Xcode/iOS license requires admin privileges, please run β€œsudo xcodebuild -license” and then retry this command.

error Command failed with exit code 1.

It asks for license. Run sudo xcodebuild -license , input password, read the terms of the software license agreements and type agree.

After that, run yarn ios again still gives an error. 

Could not parse the simulator list output

Take a step back, go to RN Getting Started.

watchman?

➜ rnw-github git:(master) βœ— brew list
yarn

LoL. There only exist yarn πŸ˜Ή

Install node via brew:

➜ rnw-github git:(master) βœ— brew install node

Install watchman:

➜ rnw-github git:(master) βœ— brew install watchman

watchman needs python as its dependency. If you got brew link error during installation:

Error: An unexpected error occurred during the `brew link` step
The formula built, but is not symlinked into /usr/local
Permission denied @ dir_s_mkdir – /usr/local/lib
Error: Permission denied @ dir_s_mkdir – /usr/local/lib

Follow this post, Brew Link – Error: Permission denied @ dir_s_mkdir, to fix it. 

➜ rnw-github git:(master) βœ— sudo mkdir /usr/local/include
➜ rnw-github git:(master) βœ— sudo chown -R $(whoami) /usr/local/include
➜ rnw-github git:(master) βœ— brew link gdbm
Linking /usr/local/Cellar/gdbm/1.18.1… 12 symlinks created
➜ rnw-github git:(master) βœ— brew link xz
Linking /usr/local/Cellar/xz/5.2.4… 53 symlinks created
➜ rnw-github git:(master) βœ— brew link pcre
Linking /usr/local/Cellar/pcre/8.42… 133 symlinks created

Tried to install watchman again, it should be installed successfully.

➜ rnw-github git:(master) βœ— brew install watchman
Updating Homebrew…
==> Downloading https://homebrew.bintray.com/bottles/watchman-4.9.0_2.mojave.bottle.tar.gz
######################################################################## 100.0%
==> Pouring watchman-4.9.0_2.mojave.bottle.tar.gz
==> launchctl unload -F /Users/haruelrovix/Library/LaunchAgents/com.github.facebook.watchman.plist
🍺 /usr/local/Cellar/watchman/4.9.0_2: 23 files, 2.1MB

Install React Native CLI:

➜ rnw-github git:(master) βœ— npm install -g react-native-cli

+ react-native-cli@2.0.1
added 41 packages from 15 contributors in 11.197s

Run yarn ios again:

Installing build/Build/Products/Debug-iphonesimulator/creaternwapp.app
An error was encountered processing the command (domain=NSPOSIXErrorDomain, code=22):
Failed to install the requested application
The bundle identifier of the application could not be determined.
Ensure that the application’s Info.plist contains a value for CFBundleIdentifier.
Print: Entry, “:CFBundleIdentifier”, Does Not Exist

Command failed: /usr/libexec/PlistBuddy -c Print:CFBundleIdentifier build/Build/Products/Debug-iphonesimulator/creaternwapp.app/Info.plist
Print: Entry, “:CFBundleIdentifier”, Does Not Exist

🀣 another error!

Seems there’s a RN bug when using Xcode 10. Fix it by following this thread:

➜ rnw-github git:(master) βœ— curl -L https://git.io/fix-rn-xcode10 | bash

Run yarn ios , the error persist πŸ˜

** BUILD FAILED **** BUILD FAILED **

The following build commands failed: Libtool /Users/haruelrovix/Projects/rnw-github/ios/build/Build/Products/Debug-iphonesimulator/libRCTWebSocket.a normal x86_64(1 failure)

Use this command to fix that:

$ cp ios/build/Build/Products/Debug-iphonesimulator/libfishhook.a node_modules/react-native/Libraries/WebSocket

Source

After that, error related to AppCenter:

The following build commands failed:The following build commands failed: CompileC /Users/haruelrovix/Projects/rnw-github/ios/build/Build/Intermediates.noindex/AppCenterReactNative.build/Debug-iphonesimulator/AppCenterReactNative.build/Objects-normal/x86_64/AppCenterReactNative.o /Users/haruelrovix/Projects/rnw-github/node_modules/appcenter/ios/AppCenterReactNative/AppCenterReactNative.m normal x86_64 objective-c com.apple.compilers.llvm.clang.1_0.compiler(1 failure)

@andangrd created a troubleshooting section to get started with AppCenter on iOS:

$ sudo gem install cocoapods –source http://rubygems.org

$ yarn add appcenter appcenter-analytics appcenter-crashes –exact

$ react-native link appcenter
$ react-native link appcenter-analytics
$ react-native link appcenter-crashes

Run yarn ios now… Finally!

gitphone @ios

gitphone @ios simulator

Leave a Comment

Capcay *