【问题标题】:react-native run-ios keeps on failingreact-native run-ios 不断失败
【发布时间】:2020-12-18 18:45:46
【问题描述】:

在将 MacOS 更新到 Big Sur 之后,由于 Legacy 版本已被弃用 react-native run-ios 不再起作用了,我尝试了很多解决方案,但没有任何进展,我为此困扰了大约 3 天。

在 xcode 上构建成功的旁注

版本:

反应原生:0.59.10

xcode: 12

我正在使用 iPhone 11 模拟器,我还尝试了一个真正的 iPhone 11 设备

npx react-native run-ios 的结果 在模拟器上:

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 myapp.xcworkspace

** BUILD FAILED **


The following build commands failed:
    Ld /myapp/ios/build/Build/Products/Debug-iphonesimulator/myapp.app/PlugIns/myapp.xctest/myapp normal
(1 failure)

模拟器上的另一个:

info ** BUILD SUCCEEDED **


info Installing DerivedData/Build/Products/Debug-iphonesimulator/myapp.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
error Command failed: /usr/libexec/PlistBuddy -c Print:CFBundleIdentifier DerivedData/Build/Products/Debug-iphonesimulator/myapp.app/Info.plist
Print: Entry, ":CFBundleIdentifier", Does Not Exist

在设备上:

info ** BUILD SUCCEEDED **

info installing and launching your app on Menna’s iPhone...
info ** INSTALLATION SUCCEEDED **

但应用程序没有出现在设备上,我不知道这怎么可能?!

任何帮助将不胜感激

【问题讨论】:

    标签: ios xcode macos react-native


    【解决方案1】:

    已解决

    1. 在 xcode 中,转到项目设置 > 将构建系统更改为新的构建系统
    2. 点击高级,然后选择自定义(相对于工作区)并指定如下位置: 产品:构建/构建/产品 中间体:build/Build/Intermediates.noindex
    3. 在vs代码中,打开node_modules/@react-native-community/cli/build/commands/runIOS/runIOS.js 并更改DerivedData/Build/Products/${configuration}-${device}/${appName}.appbuild/Build/Products/${configuration}-${device}/${appName}.app;
    4. 删除 ios/build 和 DerivedData 内容
    5. 再次运行 react-native run-ios

    【讨论】:

    • runIOS 文件夹在我的项目的命令文件夹中不存在,也没有任何 runIOS.js。
    【解决方案2】:

    尝试:

    sudo npm install -g ios-deploy --unsafe-perm

    接下来:

    yarn ios --device "YOUR_DEVICE_NAME"

    【讨论】:

      猜你喜欢
      • 2016-10-27
      • 1970-01-01
      • 1970-01-01
      • 2017-09-09
      • 2019-11-29
      • 2020-08-12
      • 2020-09-08
      • 2020-08-03
      相关资源
      最近更新 更多