Reputation: 3182
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.
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
Here’s what I’ve tried:
$(SRCROOT)
to Main Target > Build Settings > Framework Search Paths > ReleaseSkip install
set to YES
in Subproject build settingspod update
Always Embed Standard Swift Libraries
makes no difference either wayOther notes:
/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 onepodfile
, use_frameworks!
is presentUpdate:
After running an archive today I am only seeing the error:
Module 'ModuleName' not found
The other errors are gone
Upvotes: 18
Views: 9837
Reputation: 9925
I had a Podfile that set EXCLUDED_ARCHS
to arm64
in a post-install script and this was consistent with my main target. This setting was ok for building on Debug mode (x86_64) but didn't work for release building (Archives). I realised the script set EXCLUDED_ARCHS
for the Pod targets even on physical devices (Any iOS SDK) rather than only on Simulators.
pod deintegrate
.Podfile.lock
(now we have a fresh start).EXCLUDED_ARCHS
script.EXCLUDED_ARCHS
scriptI refactored:
config.build_settings['EXCLUDED_ARCHS'] = 'arm64'
from the Podfile post-install script to the following:
post_install do |installer|
installer.pods_project.targets.each do |target|
target.build_configurations.each do |config|
...
config.build_settings['EXCLUDED_ARCHS[sdk=iphonesimulator*]'] = 'arm64'
end
end
end
I haven't done watchOS here because it wasn't a watchOS app, however, we need to do this for all supported simulated device targets.
EXCLUDED_ARCHS
to arm64
to Any iOS Simulator SDK
in the main target for Release mode in the main target. The same logic here applies to other sims.pod install
Upvotes: 1
Reputation: 259
Might be not relevant to you, but helpful to others:
If you using multi-modular SwiftPM-based architecture, then you should read errors carefully and find out if some of your package targets import some other one in sources without integrating it in the Package.swift
file. In this case, even the release build will resolve dependencies somehow and succeed if some other package contains your dependency, but the archive will fail.
Package graph examples:
––––––––––
App
├– PackageA [target1(import PackageC.target1)]
└– PackageB [target1(import PackageC.target1)]
└– PackageC [target1]
👆 Builds with success, archives with errors (Can't find module PackageC.target1 in PackageA.target1)
––––––––––
App
├– PackageA [target1(import PackageC.target1)]
| └– PackageC [target1]
└– PackageB [target1(import PackageC.target1)]
└– PackageC [target1]
👆 Builds and archives with success
Upvotes: 1
Reputation: 516
I was having this error, and while my deployment targets did not match, that wasn't actually the fix for me. I had added a new build configuration that I was trying to use for my archive, but I forgot to run pod install
after adding it. After running pod install
, I was able to archive my app just fine, even though the deployment targets for some of the Pods are iOS 10 while the main app target is iOS 11.
Upvotes: 1
Reputation: 3182
The issue was to do with the iOS Deployment Target
setting:
In Debug
it is building only for the current architecture, in Release
it builds for all. Obvious once you know.
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 :(
Upvotes: 27
Reputation: 3416
It's impossible to tell what exactly causing it to fail archiving. BUT I'm pretty sure I can give you the correct direction =]
Running on simulator or even a real device - compiles the project for "Debug"
Archiving tough, compiles for "Release"
I bet that if you set that running on simulator will compile on Release mode, it will fail!
Check it!!
If I correct you just need to set some of the Build Settings
for Release to match Debug
My first guess is: All the search paths (Framework search path, and Runpath search path)
I saw a similar behavior here
I got it to archive after all.
It looked like the SDK-Project was missing a build configuration Adhoc. Which Project used to archive the project for a specific build scheme. I think the compiler was looking for modules in the $(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME) path
Upvotes: 15