项目生成并运行,但不存档 [英] Project Builds and Runs, but does not Archive
问题描述
我有一个可以在模拟器和设备上正常运行的项目,但是在归档时失败.
I have a project which builds and runs fine on the simulator and device, but fails when archiving.
该项目很旧,但是我创建了一个单独的组件,并将其添加到工作区中.
The project is very old, but I have created a separate component which I have added in the workspace.
主项目是用Objective-C编写的,新项目是用Swift 4编写的.该项目还使用CocoaPods,还包括另一个用Swift 3.2编写的子项目.
The main project is written in Objective-C, the new project is written in Swift 4. The project also uses CocoaPods and also includes another subproject written in Swift 3.2
有各种错误都归结为同一件事,子项目在编译时不会产生任何输出.或者它只是未编译.在尝试引用它时,我发现代码本身没有错误:
There are various errors which all boil down to the same thing, the sub project is not producing any output when it is compiled. OR it is just not compiled. I see no errors in the code itself, just when trying to reference it:
//1
error: /Users/<user>/Library/Developer/Xcode/DerivedData/<id>/Build/Intermediates.noindex/ArchiveIntermediates/<app name>/BuildProductsPath/Release-iphoneos/Framework.framework: No such file or directory`
//2
Signing Identity: "iPhone Developer: <redacted>"
/Users/<user>/Library/Developer/Xcode/DerivedData/<id>/Build/Intermediates.noindex/ ArchiveIntermediates/<app name>/InstallationBuildProductsLocation/Applications/<app name>/Frameworks/<framework>.framework: No such file or directory
Command /usr/bin/codesign failed with exit code 1
//3
@import ModuleName;
Module ‘ModuleName’ not found
这是我尝试过的:
- 清除派生数据
- 重新启动Mac
- 将
$(SRCROOT)
添加到主要目标">构建设置">框架搜索路径">发布" - 已确认项目存在于嵌入式二进制文件中
- 已确认项目存在于链接框架和库中
- 删除项目并将其重新添加到嵌入式二进制文件,框架和库中
- 删除导入声明
- 我要打开工作区而不是项目 在子项目的构建设置中将
-
跳过安装
设置为YES
- 将工作子项目中的构建设置与失败的子项目(它们相同)进行比较
- 正在运行
pod更新
- 更改
始终嵌入标准Swift库
两种方式都没有区别
- Clear derived data
- Restart Mac
- Add
$(SRCROOT)
to Main Target > Build Settings > Framework Search Paths > Release - Confirmed project is present in Embedded Binaries
- Confirmed project is present in Linked Frameworks and Libraries
- Removing and re-adding project to embedded binaries and frameworks and libraries
- Removing the import declaration
- I am opening the workspace and not the project
Skip install
set toYES
in Subproject build settings- Comparing build settings from the working sub project with the failing one (they are the same)
- Running
pod update
- Changing
Always Embed Standard Swift Libraries
makes no difference either way
其他说明:
- 在
/Users/<user>/Library/Developer/Xcode/DerivedData/<id>/Build/Intermediates.noindex/ArchiveIntermediates/<app name>/InstallationBuildProductsLocation/Applications/< app name>; .app/Frameworks/
中有一个用于其他子项目和所有Pod的.framework文件,但不适用于该子项目 - 在
podfile
中,存在use_frameworks!
- In
/Users/<user>/Library/Developer/Xcode/DerivedData/<id>/Build/ Intermediates.noindex/ArchiveIntermediates/<app name>/ InstallationBuildProductsLocation/Applications/<app name>.app/Frameworks/
there is a .framework file for the other sub project and all the pods, but not for this one - In
podfile
,use_frameworks!
is present
更新:
今天运行存档后,我仅看到错误:
After running an archive today I am only seeing the error:
Module 'ModuleName' not found
其他错误都消失了
推荐答案
问题与 iOS部署目标
设置有关:
- 主要项目:iOS 10
- 子项目:iOS 11
在 Debug
中,它仅针对当前体系结构进行构建;在 Release
中,其针对所有体系结构进行构建.一旦知道就很明显.
In Debug
it is building only for the current architecture, in Release
it builds for all. Obvious once you know.
设置要为iOS 10构建的子项目可以解决此问题.
Setting the sub project to build for iOS 10 fixed the issue.
最令人沮丧的部分:我仔细检查了构建日志,它在任何地方都没有提到版本问题:(
The most frustrating part: I double checked the build log and it doesn't mention the version issue anywhere :(
这篇关于项目生成并运行,但不存档的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!