Project Builds and Runs, but does not Archive

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.


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!

Screenshot of xCode Run configuration

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


The issue was to do with the iOS Deployment Target setting:

  • The main project: iOS 10
  • Sub project: iOS 11

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 :(

Tags:

Build

Xcode