Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Project Builds and Runs, but does not Archive

Tags:

xcode

ios

build

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:

  • 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 to YES 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

Other notes:

  • 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

Update:

After running an archive today I am only seeing the error:

Module 'ModuleName' not found

The other errors are gone

like image 466
lewis Avatar asked Nov 28 '17 10:11

lewis


People also ask

How do I archive a project in Xcode?

Start your archiveNavigate to your project's settings. Under iOS (or the target you want to build your app for) > Identity, you'll want to increment the Build number. For example, if the Build number was 1, you'll want to set it to 2. Then, in the top menu, under Product, click on Archive.

Where are Xcode archives stored?

Xcode created your archive. The actual . xcarchive folder resides on your Mac in ~/Library/Developer/Xcode/Archives.

Where are iOS builds stored?

It should by located in: ~/Library/Developer/Xcode/DerivedData .


1 Answers

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

like image 151
lewis Avatar answered Sep 23 '22 02:09

lewis