My React Native build works on an "iPhone 11 Pro" Simulator but fails on a real "iPhone 11 Pro" with a "unable to attach DB" error:
> npx react-native run-ios --simulator "Kunal's iPhone"
warn Multiple Podfiles were found: ios/Podfile,vendor/bundle/ruby/2.7.0/gems/cocoapods-core-1.11.3/lib/cocoapods-core/Podfile. Choosing ios/Podfile automatically. If you would like to select a different one, you can configure it via "project.ios.sourceDir". You can learn more about it here: https://github.com/react-native-community/cli/blob/master/docs/configuration.md
info Found Xcode workspace "MovieMagic.xcworkspace"
info Found booted Kunal’s iPhone, iPhone 11 Pro
info Building (using "xcodebuild -workspace MovieMagic.xcworkspace -configuration Debug -scheme MovieMagic -destination id=00008030-001245CA3A02802E")
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 MovieMagic.xcworkspace.
Command line invocation:
/Applications/Xcode.app/Contents/Developer/usr/bin/xcodebuild -workspace MovieMagic.xcworkspace -configuration Debug -scheme MovieMagic -destination id=00008030-001245CA3A02802E
User defaults from command line:
IDEPackageSupportUseBuiltinSCM = YES
Prepare packages
Computing target dependency graph and provisioning inputs
Create build description
Build description signature: 3ecfc7c39566fa70c09c9f500a168ade
Build description path: /Users/nareshbhatia/Library/Developer/Xcode/DerivedData/MovieMagic-eyukdevunxkksvclqodiaeztayqs/Build/Intermediates.noindex/XCBuildData/3ecfc7c39566fa70c09c9f500a168ade-desc.xcbuild
note: Building targets in dependency order
error: unable to attach DB: error: accessing build database "/Users/nareshbhatia/Library/Developer/Xcode/DerivedData/MovieMagic-eyukdevunxkksvclqodiaeztayqs/Build/Intermediates.noindex/XCBuildData/build.db": database is locked Possibly there are two concurrent builds running in the same filesystem location.
warning: Run script build phase 'Bundle React Native code and images' will be run during every build because it does not specify any outputs. To address this warning, either add output dependencies to the script phase, or configure it to run in every build by unchecking "Based on dependency analysis" in the script phase. (in target 'MovieMagic' from project 'MovieMagic')
warning: Run script build phase 'Start Packager' will be run during every build because it does not specify any outputs. To address this warning, either add output dependencies to the script phase, or configure it to run in every build by unchecking "Based on dependency analysis" in the script phase. (in target 'MovieMagic' from project 'MovieMagic')
** BUILD FAILED **
What am I doing wrong? I am using React Native 0.71.3 and Xcode 14.2.
P.S. I have already tried solutions like this one.