首页 > 解决方案 > React Native iOS Build - 找不到选项的目录

问题描述

描述

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

我想知道为什么 .xcodeproj 文件而不是 .xcworkspace 文件夹会发生错误,以及该错误是什么,这将有助于我防止其他项目再次发生这种情况。

反应原生版本:

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 Build 步骤需要检测 .xcworkspace 文件夹而不是 .xcodeproj,并将其用于 pod install 步骤。

小吃、代码示例、屏幕截图或存储库链接:

https://ibb.co/jWWVjb2

标签: iosxcodereact-nativevisual-studio-app-center

解决方案


嗯...我在 App Center 文档中找到了错误的原因。

如果通过 react-native 链接自动配置 App Center,则必须ios/{appname}.xcworkspace在 Xcode 中打开项目文件。与 App Center 依赖项一样,CocoaPods 仅适用于 xcworkspace 而不是 xcodeproj,并且该ios /{appname}.xcodeproj文件不会具有链接的 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


推荐阅读