question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

react-native run-ios --device failed to launch app on iPhone

See original GitHub issue

Description

I can run debug version of the app via XCode, but CLI fails to do so.

We have a few real devices as well as simulators connected to a XCode Server for CI tests, so launching the apps from CLI is crucial to us.

Running react-native run-ios --device prompts the following in the console and stuck at the last line.

$ yarn react-native run-ios --device
info Found Xcode workspace "scarletboar.xcworkspace"
info Using first available device named "SE 13.3.1" due to lack of name supplied.
info Building (using "xcodebuild -workspace [redacted].xcworkspace -configuration Debug -scheme [redacted] -destination id=[redacted]")
...........................................................
2020-04-25 16:35:02.487 xcodebuild[28201:470390] [MT] iPhoneConnect: 📱<DVTiOSDevice (0x7fb3ff324c40), SE 13.3.1, iPhone, 13.3.1 (17D50), [redacted]> == Underlying device preparation errors ==
2020-04-25 16:35:02.487 xcodebuild[28201:470390] [MT] iPhoneConnect: Failed _shouldMakeReadyForDevelopment check even though device is not locked by passcode.
Domain: com.apple.platform.iphoneos
Code: 5
Failure Reason: allowsSecureServices: 1. isConnected: 0. Platform: <DVTPlatform:0x7fb3fcc3c560:'com.apple.platform.iphoneos':<DVTFilePath:0x7fb3fcc3c2b0:'/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform'>>. DTDKDeviceIdentifierIsIDID: 0
User Info: {
    DVTDeviceDescription = "\Ud83d\Udcf1<DVTiOSDevice (0x7fb3ff324c40), SE 13.3.1, iPhone, 13.3.1 (17D50), [redacted]>";
}
--
2020-04-25 16:35:02.487 xcodebuild[28201:470390] [MT] iPhoneConnect: 📱<DVTiOSDevice (0x7fb3ff324c40), SE 13.3.1, iPhone, 13.3.1 (17D50), [redacted]> == END: Underlying device preparation errors ==
2020-04-25 16:35:02.895 xcodebuild[28201:470390] [MT] iPhoneConnect: 📱<DVTiOSDevice (0x7fb3ff324c40), SE 13.3.1, iPhone, 13.3.1 (17D50), [redacted]> == Underlying device preparation errors ==
2020-04-25 16:35:02.895 xcodebuild[28201:470390] [MT] iPhoneConnect: Failed _shouldMakeReadyForDevelopment check even though device is not locked by passcode.
Domain: com.apple.platform.iphoneos
Code: 5
Failure Reason: allowsSecureServices: 1. isConnected: 0. Platform: <DVTPlatform:0x7fb3fcc3c560:'com.apple.platform.iphoneos':<DVTFilePath:0x7fb3fcc3c2b0:'/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform'>>. DTDKDeviceIdentifierIsIDID: 0
User Info: {
    DVTDeviceDescription = "\Ud83d\Udcf1<DVTiOSDevice (0x7fb3ff324c40), SE 13.3.1, iPhone, 13.3.1 (17D50), [redacted]>";
}
--
2020-04-25 16:35:02.896 xcodebuild[28201:470390] [MT] iPhoneConnect: 📱<DVTiOSDevice (0x7fb3ff324c40), SE 13.3.1, iPhone, 13.3.1 (17D50), [redacted]> == END: Underlying device preparation errors ==
info Installing and launching your app on SE 13.3.1

React Native version:

Run react-native info in your terminal and copy the results here.

System:
    OS: macOS 10.15.4
    CPU: (4) x64 Intel(R) Core(TM) i5-4278U CPU @ 2.60GHz
    Memory: 72.53 MB / 8.00 GB
    Shell: 5.7.1 - /bin/zsh
  Binaries:
    Node: 12.13.1 - /var/folders/k_/twn4fnrn6g56kn0xjlkp3zx00000gn/T/yarn--1587804585783-0.1203554637512787/node
    Yarn: 1.22.4 - /var/folders/k_/twn4fnrn6g56kn0xjlkp3zx00000gn/T/yarn--1587804585783-0.1203554637512787/yarn
    npm: 6.14.3 - /usr/local/bin/npm
    Watchman: Not Found
  Managers:
    CocoaPods: 1.8.4 - /usr/local/bin/pod
  SDKs:
    iOS SDK:
      Platforms: iOS 13.4, DriverKit 19.0, macOS 10.15, tvOS 13.4, watchOS 6.2
    Android SDK:
      API Levels: 28, 29
      Build Tools: 27.0.3, 28.0.3, 29.0.2, 30.0.0
      System Images: android-29 | Google Play Intel x86 Atom
      Android NDK: Not Found
  IDEs:
    Android Studio: 3.6 AI-192.7142.36.36.6392135
    Xcode: 11.4.1/11E503a - /usr/bin/xcodebuild
  Languages:
    Java: 1.8.0_212-release - /usr/bin/javac
    Python: 2.7.16 - /usr/bin/python
  npmPackages:
    @react-native-community/cli: Not Found
    react: 16.11.0 => 16.11.0 
    react-native: 0.62.1 => 0.62.1 
  npmGlobalPackages:
    *react-native*: Not Found

Steps To Reproduce

Provide a detailed list of steps that reproduce the issue.

  1. Run react-native init
  2. Open the project with XCode
  3. Register a test device (iPhone) to the project
  4. Run react-native run-ios --device

Expected Results

The app launches in iPhone.

Snack, code example, screenshot, or link to a repository:

Not really related to code, and our iPhone is not responding so no screenshots. Our only clue is the CLI output above.

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:7

github_iconTop GitHub Comments

1reaction
1280103995commented, Oct 27, 2020

npm i -g --unsafe-perm=true ios-deploy it work. Thank! @vicary

1reaction
vicarycommented, Apr 28, 2020

Adding console logs after the line const iosDeployInstallArgs = [...] did nothing, not sure if there was a build system in place.

Did one thing that fixed my issue, the ios-deploy was installed with yarn global add and it doesn’t work. While I was tinkering around I did npm i -g --unsafe-perm=true ios-deploy and it went through into the iPhone.

Package version didn’t change, it was 1.10.0.

I am closing this, really don’t bother further digging this to know if it was either yarn over npm or just build configs in ios-deploy.

Read more comments on GitHub >

github_iconTop Results From Across the Web

"react-native run-ios --device" fa… | Apple Developer Forums
The react-native run-ios --device command fails with an error. The app runs on the simulator using the react-native run-ios command without any problem....
Read more >
Failed to launch the app on simulator in react native
An error was encountered processing the command (domain=com.apple.CoreSimulator.SimError, code=405): Unable to lookup in current state: ...
Read more >
Running On Device - React Native
Method 2: Connect via Wi-Fi​ · Make sure your laptop and your phone are on the same Wi-Fi network. · Open your React...
Read more >
How Run and Test React Native / Expo On Your Apple iOS ...
16:27Couldn't start project on Android: Error running adb: No Android device found. Please connect a device and follow the instructions here to enable...
Read more >
npx react-native run-android failed to launch emulator - You.com
Open your project android folder using Android Studio. 1. Click AVD Manager from Android Studio enter image description here 2. Click Create Virtual...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found