I have built and app using React Native cli, works well on Android device, Android emulator and iOS simulator. However whenever I try to debug using ios device, the app won't build. I'm using MacBook Pro M1 React Native 0.69.7 XCode 14.3 node version 19.7.0
The device I'm using is iPhone XS, iOS 16.3.1
I used the command:
yarn react-native run-ios --device
through react native terminal in gives the error message:
sr/bin/codesign --force --sign 1234567890123467890 --preserve-metadata=identifier,entitlements '/Users/<myusernamehere>/Library/Developer/Xcode/DerivedData/<appName>-9876543210987654321/Build/Products/Debug-iphoneos/<appName>.app/Frameworks/double-conversion.framework'
/Users/<myusernamehere>/Library/Developer/Xcode/DerivedData/<appName>-98765432109876543210/Build/Products/Debug-iphoneos/<appName>.app/Frameworks/double-conversion.framework: errSecInternalComponent
PhaseScriptExecution [CP]\ Embed\ Pods\ Frameworks /Users/<myusernamehere>/Library/Developer/Xcode/DerivedData/<appName-randomStringabcdefgh>/Build/Intermediates.noindex/<appName>.build/Debug-iphoneos/<appName>.build/Script-12345678901234567890.sh (in target '<appName>' from project '<appName>')
2023-04-03 15:54:23.443 xcodebuild[99293:531580] DVTCoreDeviceEnabledState: DVTCoreDeviceEnabledState_Disabled set via user default (DVTEnableCoreDevice=disabled)
** BUILD FAILED **
trying to run it from xcode (after assigning a physical device in Xcode) gives the error
Command PhaseScriptExecution failed with a nonzero exit code
I followed the instruction here https://reactnative.dev/docs/new-architecture-troubleshooting#xcode-build-issues I found the log file mentioned but it didn't give me much information of what to fix.
I then happen to come across this: FBReactNativeSpec, PhaseScriptExecution failed with a nonzero exit code
when I did which node
it gives me : /opt/homebrew/bin/node
I tried to follow the instruction and I did change the contents in my .xcode.env
file to:
export NODE_BINARY='/opt/homebrew/bin/node'
but it doesn't really help.
Could someone point out what I did wrong and why I could build and run the app successfully in the simulator, but not on iOs device.