React Native iOS 构建 - 找不到选项的目录

React Native iOS Build - Directory not found for option

描述

我正在使用 App Center 构建我的 IOS 应用程序。但它运行 pod install 并在下一步中使用 .xcodeproj 而不是 .xcworkspace 文件夹。它给出了找不到目录的错误。

我想知道为什么错误发生在 .xcodeproj 文件而不是 .xcworkspace 文件夹,那个错误是什么,这将帮助我防止其他项目再次发生这种情况。

React Native 版本:

0.61.2

步骤

1) pod依赖安装正常

==============================================================================
Task         : CocoaPods
Description  : Install CocoaPods dependencies for Swift and Objective-C Cocoa projects
Version      : 0.151.1
Author       : Microsoft Corporation
Help         : https://docs.microsoft.com/azure/devops/pipelines/tasks/package/cocoapods
==============================================================================
[command]/usr/local/lib/ruby/gems/2.6.0/bin/pod --version
1.7.5
[command]/usr/local/lib/ruby/gems/2.6.0/bin/pod install --repo-update
Updating local specs repositories
....
[!] Please close any current Xcode sessions and use `FastFeet.xcworkspace` for this project from now on.
Sending stats
Pod installation complete! There are 24 dependencies from the Podfile and 25 total pods installed.
The STDIO streams did not close within 10 seconds of the exit event from process '/usr/local/lib/ruby/gems/2.6.0/bin/pod'. This may indicate a child process inherited the STDIO streams and has not yet exited.
##[section]Finishing: Pod install

2) Xcode 构建步骤使用 sgeo.xcodeproj 而不是 sgeo.xcworkspace 并使用。这就是它失败的原因,想知道为什么。

##[section]Starting: Xcode build (not signed)
==============================================================================
Task         : Xcode
Description  : Build, test, or archive an Xcode workspace on macOS. Optionally package an app.
Version      : 4.130.0
Author       : Microsoft Corporation
Help         : [More Information](https://go.microsoft.com/fwlink/?LinkID=613730)
==============================================================================
[command]/usr/bin/xcodebuild -version
Xcode 10.3
Build version 10G8
##[warning]Output directory for build output (binaries) ignored. Specifying an output directory is incompatible with the 'archive' action.
[command]/usr/bin/xcodebuild -project /Users/vsts/agent/2.155.1/work/1/s/ios/sgeo.xcodeproj -scheme sgeo clean archive -archivePath /Users/vsts/agent/2.155.1/work/1/output/build/archive/sgeo.xcarchive CODE_SIGNING_ALLOWED=NO

...

ld: warning: directory not found for option '-L/Users/vsts/Library/Developer/Xcode/DerivedData/sgeo-byybcvsvzaukpqcrnnthwhpvohyi/Build/Intermediates.noindex/ArchiveIntermediates/sgeo/BuildProductsPath/Release-iphoneos/React-Core'
ld: warning: directory not found for option '-L/Users/vsts/Library/Developer/Xcode/DerivedData/sgeo-byybcvsvzaukpqcrnnthwhpvohyi/Build/Intermediates.noindex/ArchiveIntermediates/sgeo/BuildProductsPath/Release-iphoneos/React-DevSupport'

ld: warning: directory not found for option '-L/Users/vsts/Library/Developer/Xcode/DerivedData/sgeo-byybcvsvzaukpqcrnnthwhpvohyi/Build/Intermediates.noindex/ArchiveIntermediates/sgeo/BuildProductsPath/Release-iphoneos/React-RCTActionSheet'
ld: warning: directory not found for option '-L/Users/vsts/Library/Developer/Xcode/DerivedData/sgeo-byybcvsvzaukpqcrnnthwhpvohyi/Build/Intermediates.noindex/ArchiveIntermediates/sgeo/BuildProductsPath/Release-iphoneos/React-RCTAnimation'

** ARCHIVE FAILED **


The following build commands failed:
    Ld /Users/vsts/Library/Developer/Xcode/DerivedData/sgeo-byybcvsvzaukpqcrnnthwhpvohyi/Build/Intermediates.noindex/ArchiveIntermediates/sgeo/IntermediateBuildFilesPath/sgeo.build/Release-iphoneos/sgeo.build/Objects-normal/arm64/sgeo normal arm64
(1 failure)
##[error]Error: /usr/bin/xcodebuild failed with return code: 65
##[section]Finishing: Xcode build (not signed)

预期结果

App Center 构建步骤需要检测 .xcworkspace 文件夹而不是 .xcodeproj,并将其用于 pod 安装步骤。

快餐、代码示例、屏幕截图或 link 存储库:

https://ibb.co/jWWVjb2

嗯...我在应用中心文档中找到了错误的原因。

如果您通过 react-native link 自动配置 App Center,您必须在 Xcode 中打开项目的 ios/{appname}.xcworkspace 文件。与 App Center 依赖项一样,CocoaPods 仅适用于 xcworkspace 而不是 xcodeproj,并且 ios /{appname}.xcodeproj 文件将没有 linked App Center CocoaPods 依赖项。

所有信息均由申请中心提供:https://docs.microsoft.com/en-us/appcenter/sdk/getting-started/react-native#42-build-and-run-your-application-from - xcode-or-android-studio

我遇到了同样的问题。 实际上,iOS 部署目标在 Project>Info>Deployment 中定义为 11,在 PodFile 中定义为 iOS 11。但是在 Targets>Build Settings>Basic>Deployment>iOS Deployment Target设置为 9.

我刚刚在所有地方都改为 iOS 11。 有效。