React Native developer Menu not loading - ios

Developer menu in ios simulator will not launch with either cmd + D or cmd + ctrl + z
things i've checked (in no order) :
cmd + r works properly
myApp and myAppTests schemes are set to debug mode
Slow Animations is off
Hardware > Keyboard > Connect Hardware Keyboard is on
watchman 4.7.0 is installed with brew install watchman (--HEAD needed libtoolize, in which brew changed to glibtoolize, therefore ./autogen couldn't find it )
Cleaned out Derived Data folder
Created new scheme for target
Upgraded XCode to 8.2.1 -> 8.3.1
react-native start --clear-cache starts successfully, react-native run-ios builds successfully
Other Issues
nw_connection_get_connected_socket_block_invoke 1262 Connection has no connected handler run indefinitely
react-native run-ios outputs
Command failed: /usr/libexec/PlistBuddy -c Print:CFBundleIdentifier build/Build/Products/Debug-iphonesimulator/zelosApp.app/Info.plist
Print: Entry, ":CFBundleIdentifier", Does Not ExistCommand failed: /usr/libexec/PlistBuddy -c Print:CFBundleIdentifier build/Build/Products/Debug-iphonesimulator/zelosApp.app/Info.plist
Print: Entry, ":CFBundleIdentifier", Does Not Exist
Versions
react-native = "^0.43.3"
watchman = "4.7.0"
xcode = "8.3.1"
Any tips / questions would be greatly appreciated!

This happens to me too once in a while, and I have not been able to figure out why. However, one workaround is to select Device -> Shake in the simulator menu.

Are you using cocoa pods?
I had this issue as well. I believe the issue is from React being included twice. Once from your main project, and once through the Pods workspace.
Try the fix here: https://github.com/react-native-community/react-native-svg/issues/621
Namely the post install fix on the Podfile:
post_install do |installer_representation|
installer_representation.pods_project.targets.each do |target|
if target.name == "React"
target.remove_from_project
end
end
end
Then, remove any references to the React framework like in linked frameworks in the Xcode project.
I'm able to bring the debug menu back up.

The error was with my importing react in my podfile. React Native .43 found here https://github.com/facebook/react-native/issues/10366

Search your MainApplication.java for any import ... BuildConfig. For example import androidx.multidex.BuildConfig; and REMOVE it

Related

React Native - FBReactNativeSpec Command PhaseScriptExecution failed with a nonzero exit code

I am using a MacBook Pro with
M1 chip
MacOS Big Sur
Xcode Version 13.2.1
node v14.17.5
I wanted to follow this tutorial to set up a new React Native project called AwesomeProject https://reactnative.dev/docs/environment-setup the section with React Native CLI Quickstart.
When I try to run the app in terminal by typing: npx react-native run-ios
my build fails with the following error:
PhaseScriptExecution [CP-User]\ Generate\ Specs /Users/thomashuber/Library/Developer/Xcode/DerivedData/AwesomeProject-aprperxvqrezbfeyvousbagyesvr/Build/Intermediates.noindex/Pods.build/Debug-iphonesimulator/FBReactNativeSpec.build/Script-5F4C70EF7D90A5A5BDAEB404279F232A.sh (in target 'FBReactNativeSpec' from project 'Pods')
(1 failure)
When I try to run it in Xcode either on a simulator or on an iPhone device I get the following error in FBReactNativeSpec:
/bin/sh -c /Users/thomashuber/Library/Developer/Xcode/DerivedData/AwesomeProject-aprperxvqrezbfeyvousbagyesvr/Build/Intermediates.noindex/Pods.build/Debug-iphonesimulator/FBReactNativeSpec.build/Script-5F4C70EF7D90A5A5BDAEB404279F232A.sh
Command PhaseScriptExecution failed with a nonzero exit code
I restarted my MacBook, I deleted the project and tried it again. I cleaned the project in Xcode but none of it helps. I suspect that it is due the M1 chip of my MacBook.
For me anyone of this solutions work because, with Xcode 14.2 and RN0.70.5, there is the following 2 files in ios folder which fixe node version with the path (I don't know since which version and which one adds this files) :
.xcode.env
.xcode.env.local
If you are this files inside ios folder just do this (with or without nvm) :
which node
And put the patch inside the .xcode.env.local like this :
export NODE_BINARY="/Users/Blabla/.nvm/versions/node/v16.14.0/bin/node"
If this files doesn't exist, try to add it and maybe Xcode will take it into account :
Inside ios/.xcode.env
# This `.xcode.env` file is versioned and is used to source the environment
# used when running script phases inside Xcode.
# To customize your local environment, you can create an `.xcode.env.local`
# file that is not versioned.
# NODE_BINARY variable contains the PATH to the node executable.
#
# Customize the NODE_BINARY variable here.
# For example, to use nvm with brew, add the following line
# . "$(brew --prefix nvm)/nvm.sh" --no-use
export NODE_BINARY=$(command -v node)
Inside ios/.xcode.env.local
export NODE_BINARY="/Users/Blabla/.nvm/versions/node/v16.14.0/bin/node"
If you shut down your computer or did a recent upgrade to node or nvm something in the cache folder gets reset and the build fails. The code in the react native node_modules/react-native/scripts/find-node.sh script related to nvm. Following this advice: https://stackoverflow.com/a/70104375/5927929 worked for me with a small change.
My specs:
Mac intel chip
RN 0.68.2
nvm (0.33.11) && node (v18.3.0) install
Steps:
nvm unalias default
nvm alias default node
Build in xcode...done
I managed to get rid of the FBReactNativeSpec error by editing the Project settings.
Try the following:
In Xcode select your app's project and then select the target.
In Terminal enter the following command to find out the path of your node installation:
which node
This should give you a path. Something like:
/Users/thomashuber/.nvm/versions/node/v16.14.0/bin/node
Copy this path.
In Xcode with the target selected click on Build Phases and open Bundle React Native code and images
Replace NODE_BINARY=node. Instead of node enter the path that you have copied so that it is something like this NODE_BINARY=/Users/thomashuber/.nvm/versions/node/v16.14.0/bin/node
Simply delete the FBReactNativeSpec file from the Pods as shown in the image below.enter image description here
In my case this error raising due to node path is not set in PATH Variables.
Try to run below command it will set missing node path in PATH variable and it resolve the error.
sudo ln -s $(which node) /usr/local/bin/node
https://reactnative.dev/docs/new-architecture-troubleshooting#:~:text=Command%20PhaseScriptExecution%20failed%20with%20a,libraries%20(FBReactNativeSpec%2C%20rncore).
Ok, worth trying this.
2 different solutions :
1: As soon as we get this error message:
Always scroll up & read the issue if written in that log file. Any issues like syntax error or issue related to your js code (like multiple imports in your js files or if you had forgot to import something).
If yes, you can fix that first & re build it.
In my case I had multiple imports of one of the RN components.
if not
2: got to 'Keychain access' in your mac, lock & unlock login and re build it, this may help you.
And make sure to
'cd ios' && 'pod install'
if you have forgot to do it after installing any of the npm package.
In case someone else tried everything mentioned here and in other threads, and it didn't work, here is what worked for me!
I uninstalled my nvm install
installed node globally (https://nodejs.org/en/download/)
ran pod install and got this error message:
[!] CocoaPods could not find compatible versions for pod "hermes-engine":
In snapshot (Podfile.lock):
hermes-engine (from ../node_modules/react-native/sdks/hermes/hermes-engine.podspec)
In Podfile:
hermes-engine (from ../node_modules/react-native/sdks/hermes/hermes-engine.podspec)
It seems like you've changed the version of the dependency hermes-engine and it differs from the version stored in Pods/Local Podspecs.
You should run pod update hermes-engine --no-repo-update to apply changes made locally.
But instead of running the command they gave me, I deleted Podfile.lock and the Pods directory, then reran pod install, and the build finally worked!
Determine what your node binary is:
$ which node
/opt/homebrew/bin/node
Add a fixer function in your Podfile:
def fix_fb_react_native_spec(installer)
installer.pods_project.targets.each do |target|
if target.name == 'FBReactNativeSpec'
target.build_configurations.each do |config|
if config.name == 'Debug' or config.name == 'Release'
config.build_settings['NODE_BINARY'] = '/opt/homebrew/bin/node'
end
end
end
end
end
In your postinstall, add fix_fb_react_native_spec(installer) like so:
post_install do |installer|
react_native_post_install(installer)
fix_fb_react_native_spec(installer)
end
Pod install
Rebuild (ideally with a clean build)
In my case:
M1 chip
MacOS Monterey
Xcode Version 13.2.1
node v16.6.0
react-native 0.69
I was trying to build the iOS app via terminal under Rossetta. Once I tried to use native M1 terminal - it worked well.
Go to your applications, right click on the app, get info, check OFF Open using Rossetta

Build is failing for older projects for React-Native iOS XCode Version 12.5

It is very new to me see this problem which started happening recently. Previously my app used to work fine on the iOS simulator by running this command react-native run-ios. Now I have done a lot of research and made my app run via XCode. But somehow the metro bundler is not linked when the app runs via XCode.
I tried running the app via react-native run-ios and every time I am seeing this error. It is too big to copy paste every error here, but here are some of them:
Undefined symbols for architecture x86_64:
"Swift._ArrayBuffer._copyContents(initializing: Swift.UnsafeMutableBufferPointer<A>) -> (Swift.IndexingIterator<Swift._ArrayBuffer<A>>, Swift.Int)", referenced from:
generic specialization <serialized, Swift._ArrayBuffer<Swift.Int8>> of Swift._copyCollectionToContiguousArray<A where A: Swift.Collection>(A) -> Swift.ContiguousArray<A.Element> in libMixpanel-swift.a(AutomaticProperties.o)
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
** BUILD FAILED **
The following build commands failed:
Ld /Users/careerlabsdev/Library/Developer/Xcode/DerivedData/CareerLabs_Elev8-gxcfanteiuxazegkgwkjkrjxbdmw/Build/Products/Debug-iphonesimulator/CareerLabs.app/CareerLabs normal
(1 failure)
I have done a lot of things to make it to work. The only success I got here is, while running the command react-native run-ios, it opens up the metro bundler server. After that it fails with giving a 1000 lines of error. I picked the error which had some cream part. Some key words to pick from the error:
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
Did not understand the word Ld, which is listed under BUILD FAILED
What I did is as follows:
Deleting node_modules, Pods. Cleaning the build from XCode. Running npm install and then cd ios && pod install and then ran the command react-native run-ios
Deleting Pods, Podfile.lock. Did pod install and then in the root react-native run-ios
Doing these:
rm -rf ~/Library/Caches/CocoaPods
rm -rf Pods
rm -rf ~/Library/Developer/Xcode/DerivedData/*
pod deintegrate
pod setup
pod install
cd ..
react-native run-ios
Restarted the system, and ran the command again react-native run-ios
Added arm64 in the Excluded Architecture from XCode. Please note, this enabled me to build and run the app successfully on XCode. But it doesn't get attached to the metro bundler server. Looks like it runs the release mode only.
Updated my package react-native-gesture-handler to the latest one which is 1.10.3, to see if that removes my problem. But no luck.
My Podfile look like this:
platform :ios, '10.0'
use_flipper!({'Flipper' => '0.81.0'})
post_install do |installer|
flipper_post_install(installer)
installer.pods_project.targets.each do |target|
target.build_configurations.each do |config|
config.build_settings.delete 'IPHONEOS_DEPLOYMENT_TARGET'
end
end
end
I am out of options now, and waiting for some insight to be given. It is indeed frustrating to see an error on something which never created a problem. I am using Apple M1 Chip Macbook.
Update V1.0
I have tried commenting down the use_flipper!(), from the /ios/Podfile, and then redid the same things, like removing Pods, Podfile.lock. Running this command, pod update && pod install && cd.. && npm run ios. Ran into multiple issues. I don't know what the issue is with XCode and React Native on Apple M1.
Update V2.0
I have found some significant places where the developers are complaining about the same. XCode has forced updated my version to 12.5, without my notice. And now XCode is creating a problem with RN Older projects. Here are the supportive links for the same:
Flipper doesn't build with XCode 12.5 (GitHub)
Do I need Flipper? (Reddit)
I hope this may give some insight to the developers who are confused like me. Please take a look, and looks like Facebook is fixing it, but don't know when. Have to keep an eye on it :/
The one hacky thing which I did to make my app run again like before, is to downgrade the XCode Version to the previous stable one, that is Version 12.4. I knew about the problem later, cos, XCode force updated my version which started behaving weird with my already existing project. So the only viable option I saw is to downgrade the version to the previous one, and everything worked like before.
Please Note: This issue exists majorly with Apple M1 along with XCode v12.5 and BigSur OS. So go ahead keeping these things in your mind.
For this, I had to do these things:
Uninstall the XCode completely from the Mac. To do that efficiently, considering XCode does caches a lot of things on your Mac, use Mac App Cleaner. If by any chance, you have just removed the XCode without using the link, then use this Completely remove Xcode from Mac.
Install the XCode from this resource XCode Releases. Please Note: This is a legit source which takes you directly to the Apple's download pages, and no unreliable thing. So you can just go ahead and download the previous stable version of the XCode, with which your app was working fine.
Please Note: Installing the XCode from App Store will again install the latest version of the XCode which is buggy v12.5. So please don't download and install the same from Apple Store. Use the above mentioned source only for best results.
Install it when the file is downloaded. Make sure you follow this Setting up development environment React Native, to avoid any mishaps.
Run the app again.
It will work for you, as it did work for me, and now I am continuing my work on my project without any hassle. Cheers!
I am guessing all third party Pods will need to update their RN Pod Specs to use XCFrameworks. That's what I just did and it seems to work ok.
This means that you, as an RN package user, you will either need to wait for the package authors to update their podspecs to use XCFrameworks or add a build config that excludes the 'arm64' arch (but then will not work on M1 macs).
Alternatively, you can visit the node_modules/<package>/thrid-party.podspec and update it yourself. But that means you will need to build the XCFrameworks yourself too. So.....

React Native Built Failed

The following build commands failed:
PhaseScriptExecution Install\ Third\ Party /Users/iChep/Documents/Coding/React\ Native\ Apps/albums/ios/build/Build/Intermediates/React.build/Debug-iphonesimulator/double-conversion.build/Script-190EE32F1E6A43DE00A8543A.sh
(1 failure)
Installing build/Build/Products/Debug-iphonesimulator/albums.app
No devices are booted.
Print: Entry, ":CFBundleIdentifier", Does Not Exist
Command failed: /usr/libexec/PlistBuddy -c Print:CFBundleIdentifier build/Build/Products/Debug-iphonesimulator/albums.app/Info.plist
Print: Entry, ":CFBundleIdentifier", Does Not Exist
I get this issues when trying to built my react native application. I know that this issue is a common one, but I'm trying to solve since 10 hours and I tryed nearly every solution on the Facebook Trubleshooting page and on the github issue page. I'm really frustrated and would appreciate the help.
I'm using Node: 8.1.2,
XCode: 8.3.3,
npm: 5.0.3,
react-native-cli: 2.0.1,
react-native: 0.45.1
When nothing fixes, try on Xcode
Go to File -> Project settings
Click the Advanced button
Select "Custom" and select "Relative to Workspace" in the pull down
click done, done
The reference is this issue on GitHub.

Facebook SDK causes React Native build to fail

My team is building our first iOS app using React Native. For some reason on my Mac only, the build fails after running react-native run-ios. This has been happening since we added Facebook authentication with the react-native-fbsdk.
We are all running node -v 7.0 and the latest version of Xcode. I have even tried deleting the repo locally and cloning it back down. As an experiment, another member of my team deleted his repo locally, cloned it back down, and was able to get everything working. We sat next to each other and did the exact same steps and it worked for him but not me.
Below is the error message I receive in my terminal:
** BUILD FAILED **
The following build commands failed:
CompileC /Users/philmok/js_projects/pLot/ios/build/Build/Intermediates/RCTFBSDK.build/Debug-iphonesimulator/RCTFBSDK.build/Objects-normal/x86_64/RCTFBSDKGraphRequestManager.o RCTFBSDK/core/RCTFBSDKGraphRequestManager.m normal x86_64 objective-c com.apple.compilers.llvm.clang.1_0.compiler
(1 failure)
Installing build/Build/Products/Debug-iphonesimulator/pLot.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
Command failed: /usr/libexec/PlistBuddy -c Print:CFBundleIdentifier build/Build/Products/Debug-iphonesimulator/pLot.app/Info.plist
Print: Entry, ":CFBundleIdentifier", Does Not Exist
Per the answer on this question, I have tried running react-native upgrade. This will allow the build to complete but it prevents Facebook authentication from working.
Make sure you have downloaded the FBSDK for fb login. Place it in your documents folder and then open your project in xcode. click your project in the left menu and select the build settings tab, give 'framework path' the path to your FBSDK in documents.
add
pod 'FBSDKCoreKit'
pod 'FBSDKLoginKit'
pod 'FBSDKShareKit'
to your Podfile and then pod install
Did you went through all configuration steps? Here is great introduction, step by step how to add facebook sdk to react native app: https://github.com/magus/react-native-facebook-login . Btw. I recommend to use this lib if you can, I had many problems with official facebook sdk, moved to that one, and everything works.

React Native Build Commands Failed: PhaseScriptExecution ... (domain=NSPOSIXErrorDomain, code=2)

Environment
Mac OS X Version 10.11.3 (15D21)
Xcode Version 7.2 (7C68)
Simulator Version 9.2 (SimulatorApp-643)
react-native-cli 0.1.10
node v5.5.0
What I did before running the app
npm install -g react-native-cli
react-native init DemoProjectDELETEME
cd ./DemoProjectDELETEME
react-native run-ios
I am new to React Native. When I try to run the default app on iOS simulator I got the following errors. I found a similar issue but it does not solve my problem.
Xcode6 can't run any app in simulator ( Domain = NSPOSIXErrorDomain, Code = 3 )
After restart the machine and simulator the issues still persistent.
** BUILD FAILED **
The following build commands failed:
PhaseScriptExecution Run\ Script /Users/x/Desktop/DemoProjectDELETEME/ios/build/Build/Intermediates/React.build/Debug-iphonesimulator/React.build/Script-006B79A01A781F38006873D1.sh
(1 failure)
Installing build/Build/Products/Debug-iphonesimulator/DemoProjectDELETEME.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/x/Desktop/DemoProjectDELETEME/node_modules/promise/lib/done.js:10
throw err;
^
Error: Command failed: /usr/libexec/PlistBuddy -c Print:CFBundleIdentifier build/Build/Products/Debug-iphonesimulator/DemoProjectDELETEME.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:77:34)
at runIOS.js:24:5
at tryCallTwo (/Users/x/Desktop/DemoProjectDELETEME/node_modules/promise/lib/core.js:45:5)
at doResolve (/Users/x/Desktop/DemoProjectDELETEME/node_modules/promise/lib/core.js:200:13)
at new Promise (/Users/x/Desktop/DemoProjectDELETEME/node_modules/promise/lib/core.js:66:3)
at Array.runIOS (runIOS.js:23:10)
at Object.run (/Users/x/Desktop/DemoProjectDELETEME/node_modules/react-native/local-cli/cli.js:86:13)
at Object.<anonymous> (/usr/local/lib/node_modules/react-native-cli/index.js:73:7)
Got the follower error when I am trying to launch the app from Xcode.
sudo npm start in project root solves the issue, but react-native run-ios still BUILD FAILED.
Thanks for your time viewing my question.
Try running react-native upgrade
See Github thread: https://github.com/facebook/react-native/issues/7308#issuecomment-219597774
For me port 8081 was in use :
lsof -n -i4TCP:8081
1.Go to File -> Project settings
2.Click the Advanced button
3.Select "Custom" and select "Relative to Workspace" in the pull down
4.Change "Build/Products" to "build/Build/Products"
5.click done, done
The problem is in the js file that builds and runs your app. Unless your project, scheme, and Product Name are all the same, you'll get errors, especially on simulators.
The good news is that I submitted a pull request that fixes the problem. Please go upvote it so we don't have worry about things breaking when we rename things.
For me I just needed to edit the iOS project build settings
Product Bundle Identifier was not set
You need to set it for both the Project and 2 Targets
Open your react-native project in Xcode
Create a new schema with project name.
the problem will be solved
Adding sudo in front of all commands solves the problem.
sudo react-native init ProjectName
sudo chmod 777 ProjectName
cd ProjectName
sudo react-native run-ios
For me, I needed to upgrade my version of XCode from Yosemite to Sierra.
This can be done via App Store > Updates.
What worked for me was running pod install from the ios directory
Running
npx pod-install
solved the problem for me.
Open Your Xcode project
Run it
You should have 2 errors from RCTSRWebSocket.m
add (void) to the beginning of both line :
SecRandomCopyBytes(kSecRandomDefault, sizeof(uint32_t), (uint8_t *)mask_key);
become
(void)SecRandomCopyBytes(kSecRandomDefault, sizeof(uint32_t), (uint8_t *)mask_key);
Save and Re-run your project with Xcode or terminal. It should work for sure. I have tested all the solution before, this one is the only who worked for me.
Surprisingly, this was the solution for me: Open the file Views/RTCScrollView.m in Xcode and change the variable _refreshControl to refreshControl. All occurrences of _refreshControl were already marked as errors. The new code becomes:
- (void)setRefreshControl:(RCTRefreshControl *)refreshControl
{
if (refreshControl) {
[refreshControl removeFromSuperview];
}
refreshControl = refreshControl;
[self addSubview:refreshControl];
}
I fixed my issue, you can try it if you are in the same condition.
I encountered the same error:
Print: Entry, ":CFBundleIdentifier", Does Not Exist
When I clone an existing react-native project from learning react native.
I initialize (using {react-native init yourProjectName}) a new project with the same name in a different directory
copy every useful *.ios.js file to this new project from the one I clone elsewhere.
This works for me.
Edit the file ,ProjectName/node_modules/react-native/local-cli/runIOS/runIOS.js
Line no 18 : replace the entire line of code with the following :
return `build/Build/Products/${configuration}-${isDevice ? 'iphoneos' : 'iphonesimulator'}/${appName}.app`;
Line no: 146: uncomment '-derivedDataPath', 'build',
after that run the command from the terminal: sudo react-native run-ios
For me, my problem was that Mcafee is running on port 8081, so I run the app on a different port following this answer https://stackoverflow.com/a/50649969/5323419
Basically:
react-native run-ios --port 1234
react-native start --port 1234
I am using React native 0.55+
Try to run
npx pod-install
Also check the permissions. Maybe you should run react-native run-ios with sudo?
For my case:
If your project folder name called like "Example Project"
You must change it to "Example_Project"
Spaces are causen this error.

Resources