TL;DR – My React Native project runs/renders successfully. The reload or developer tools on device shake abilities are not working.
I've setup React Native within an existing project following this guide. I am able to successfully render my React Native views with the following:
(JS_DIR=pwd/js; cd node_modules/react-native; npm run start -- --root $JS_DIR)
However, once the simulator is running I cannot use command+r to reload the JavaScript, nor am I able to use command+control+z to display the developer tools.
I did not use react-native init <ProjectName>
to create the project. I am adding React Native to an existing Swift project. I am not using react-native run-ios
as it throws the following errors:
** BUILD FAILED **
The following build commands failed:
CompileC /Users/username/Sites/iOS/project-name/build/Build/Intermediates/Pods.build/Local-iphonesimulator/FXBlurView.build/Objects-normal/x86_64/FXBlurView.o FXBlurView/FXBlurView/FXBlurView.m normal x86_64 objective-c com.apple.compilers.llvm.clang.1_0.compiler
CompileC /Users/username/Sites/iOS/project-name/build/Build/Intermediates/Pods.build/Local-iphonesimulator/FXBlurView.build/Objects-normal/i386/FXBlurView.o FXBlurView/FXBlurView/FXBlurView.m normal i386 objective-c com.apple.compilers.llvm.clang.1_0.compiler
CompileC /Users/username/Sites/iOS/project-name/build/Build/Intermediates/Pods.build/Local-iphonesimulator/FXBlurView.build/Objects-normal/x86_64/FXBlurView-dummy.o Target\ Support\ Files/FXBlurView/FXBlurView-dummy.m normal x86_64 objective-c com.apple.compilers.llvm.clang.1_0.compiler
CompileC /Users/username/Sites/iOS/project-name/build/Build/Intermediates/Pods.build/Local-iphonesimulator/FXBlurView.build/Objects-normal/i386/FXBlurView-dummy.o Target\ Support\ Files/FXBlurView/FXBlurView-dummy.m normal i386 objective-c com.apple.compilers.llvm.clang.1_0.compiler
(4 failures)
Installing build/Build/Products/Debug-iphonesimulator/ProjectName.app
An error was encountered processing the command (domain=NSPOSIXErrorDomain, code=2):
Failed to install the requested application
An application bundle was not found at the provided path.
Provide a valid path to the desired application bundle.
Print: Entry, ":CFBundleIdentifier", Does Not Exist
/Users/username/Sites/iOS/project-name/node_modules/promise/lib/done.js:10
throw err;
^
Error: Command failed: /usr/libexec/PlistBuddy -c Print:CFBundleIdentifier build/Build/Products/Debug-iphonesimulator/ProjectName.app/Info.plist
Print: Entry, ":CFBundleIdentifier", Does Not Exist
at checkExecSyncError (child_process.js:464:13)
at Object.execFileSync (child_process.js:484:13)
at _runIOS (runIOS.js:91:34)
at runIOS.js:24:5
at tryCallTwo (/Users/username/Sites/iOS/project-name/node_modules/promise/lib/core.js:45:5)
at doResolve (/Users/username/Sites/iOS/project-name/node_modules/promise/lib/core.js:200:13)
at new Promise (/Users/username/Sites/iOS/project-name/node_modules/promise/lib/core.js:66:3)
at Array.runIOS (runIOS.js:23:10)
at Object.run (/Users/username/Sites/iOS/project-name/node_modules/react-native/local-cli/cli.js:86:13)
at Object.<anonymous> (/Users/username/.nvm/versions/node/v4.2.4/lib/node_modules/react-native-cli/index.js:88:7)
What should I look for to get the reload and developer tools abilities working?
Fast Refresh is a React Native feature that allows you to get near-instant feedback for changes in your React components. Fast Refresh is enabled by default, and you can toggle "Enable Fast Refresh" in the React Native developer menu. With Fast Refresh enabled, most edits should be visible within a second or two.
If you have custom configurations and you're using Cocoapods, make sure the Podfile
specifies that those configurations should be debug
configurations. By default they are assumed to be release
configurations. Add the following line to the top of your Podfile
(assuming your custom configs are "Dev", "Local", and "Staging"):
For pre-1.0 Cocoapods use xcodeproj
:
xcodeproj 'MyProject', 'Dev' => :debug, 'Local' => :debug, 'Staging' => :debug
For Cocoapods 1.0+ use project
:
project 'MyProject', 'Dev' => :debug, 'Local' => :debug, 'Staging' => :debug
Then, to get the Pods.xcodeproj
file to update:
rm -rf Pods/
pod install
This will ensure the DEBUG=1
Preprocessor Macro is set for those configurations for the Pods
project.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With