0

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.

Naresh
  • 23,937
  • 33
  • 132
  • 204

1 Answers1

0

The provided log message isn't too helpful to solve your problem.

However, in the first line you are passing --simulator as argument.

So if you run

npx react-native run-ios --device 

it would try to run in your real device.

If you run npx react-native run-ios --help you will see that we need to do --device when you want to run on a real device. Explicitly set device to use by name. The value is not required if you have a single device connected.

This is all you need assuming you have the developer certificate in your machine.

Make sure you are following the steps of how to run on a real device

https://reactnative.dev/docs/running-on-device

Specially #2 Configure code signing

  • Thanks for helping, Ribamar. I have done step #2 from the docs - it's simply to select my Apple Developer account (team), correct? Still giving the same error. Also tried `npx react-native run-ios --device` - same error :-( – Naresh Mar 17 '23 at 04:32