Based on the environment
OS X: V10.14.1 Xcode: V10.1 (10B61) Node: V10.15.3 Npm: V6.4.1 Yarn: V1.15.2 Watchman: V4.7.0 React-native cli: V2.x React: v16.8.3 React-native: V0.59.2Copy the code
Please keep Node version > v8.3 && !v9.x
Set the global yarn or NPM image source as prompted on the official website. Registry.npm.taobao.org, do not use cnpm.xxx
FAQ Analysis
runreact-native run-iosError may be reported:
Error: Command failed: /usr/libexec/PlistBuddy -c Print:CFBundleIdentifier build/Build/Products/Debug-iphonesimulator/AwesomeProject.app/Info.plist
Print: Entry, ":CFBundleIdentifier", Does Not Exist
Copy the code
Solution: This issue has a bunch of solutions for this type of bug, and there’s always one for you github.com/facebook/re…
I tried most of them, but I still failed!
If the following figure is encountered after startup:
Must wait patiently, cannot stop! The first time run-ios can take 10-30 minutes, with more than 2 gigabytes of content to download, then you might see the simulator start up automatically, arrive at the home page of the phone and then wait. Wait patiently for the above two window programs to complete.
Normally, when the above program is finished, the white window continues to listen for local code, and the emulator automatically opens the current project and displays it.
It is possible for both Windows to report different errors:
To ensure that the current system user has all file permissions for this item:
Sudo chmod -r 777 AwesomeProject
Sudo -s && sudo chmod -r 777 AwesomeProject
The emulator cannot start
If the developer manually exits the emulator and the emulator process is still running, the emulator cannot be opened again. You need to manually terminate the process:
Lsof -n-i4TCP :8081 // Check the process under the project port,kill9 [your] pid / / end related process Can also perform the rm - rf ~ / Library/Developer/CoreSimulator/Devices / / delete the simulator has been loading equipment Such as iOS 12.1 killall - 9 Com. Apple. CoreSimulator. CoreSimulatorService/process/end simulatorCopy the code
There is no response after the simulator is started
After the terminal program is executed, the emulator still does not respond. You can check whether your project exists on the emulator desktop, as shown in the figure below:
Case 1:
Click to open it manually
Situation 2:
Opendir (/ Users/gokuai/Documents/hobby/AwesomeProject/node_modules/react - native/third party/glog - 0.3.5 / conftSpW3r) - > Permission denied. Marking this portion of the tree deleted To clear this warning, run: `watchman watch-del /Users/gokuai/Documents/hobby/AwesomeProject ; watchman watch-project /Users/gokuai/Documents/hobby/AwesomeProject` Loading dependency graph, done.Copy the code
Why is the terminal calling you?
/ / path to pay attention to your PC: watchman watch - del/Users/gokuai/Documents/hobby/AwesomeProjectCopy the code
It may also be found that:
Runtime is not ready for debugging. Mkae sure Packager server is running.
Copy the code
Reference github.com/facebook/re…
@jsina commented on 27 Jul 2018
// I'll just do the following:export NODE_BINARY=node
S: react-native bundle --entry-file='index.js' --bundle-output='./ios/main.jsbundle' --dev=false --platform='ios' --assets-dest='./ios'
Copy the code
Then open the emulator project CMD + R
Problem with emulator not updating code
However refreshing CMD +R CMD +D will not make the emulator refresh the code, please try:
Enable and enable the emulator Hardware => Keyboard => Connect Hardware Keyboard to ensure network synchronization.
Project error when emulator is opened
No bundle URL present.
Make sure you're running a packager server or have inclouded a .jsboundle file in your application bundle.
Copy the code
As shown in figure:
Other errors
error Failed to build iOS project. We ran "xcodebuild" command but it exited with error code 65.
To debug build logs further, consider building your app with Xcode.app,by opening reactApp.xcodeproj
Copy the code
- Open the current project in Xcode
- Select File => Project Setting => Advanced => Custom => Relative to workspace => done => done
- rm -rf node_modules
- killall -9 com.apple.CoreSimulator.CoreSimulatorService
- sudo react-native run-ios
Such as:
info ** BUILD SUCCEEDED **
info Installing build/AwesomeProject/Build/Products/Debug-iphonesimulator/AwesomeProject.app
An error was encountered processing the command(domain=NSPOSIXErrorDomain, code=2): lstat of /Users/gokuai/Documents/hobby/AwesomeProject/ios/build/AwesomeProject/Build/Products/Debug-iphonesimulator/AwesomeProjec t.app failed: No such file or directory No such file or directory info Launching org.reactjs.native.example.AwesomeProject org.reactjs.native.example.AwesomeProject: 29514Copy the code
or
** BUILD SUCCEEDED **
Installing build/AwesomeProject/Build/Products/Debug-iphonesimulator/AwesomeProject.app
Launching org.reactjs.native.example.AwesomeProject
org.reactjs.native.example.AwesomeProject: 29514
Copy the code
does
rm -rf ios/build
rm -rf node_modules
react-native upgrade
yarn
lsof -n -i4TCP:8081
kill -9 [your pid]
sudo -s && sudo chmod -R 777 AwesomeProject
sudo react-native run-ios
Copy the code
When you look at this picture:
You can also interrupt it by pressing Ctrl + C, Yarn Start or NPM start to restart and synchronize with the emulator
From what has been discussed above
If the above situation still fails to solve the problem, please check your own environment again, or try to change the React-Native version and try again, to figure out the execution order and basically solve the problem
If it is still not possible, please try the same operation as follows: