Can build my app but not Archive

Apologies that this is probably a simple problem.

I've started from a sample code provided by Apple and changed it quite significantly. However, I'm not able to Archive the app.

The original visionOS sample code has the same issue, so hopefully someone will be able to spot the problem:

https://developer.apple.com/documentation/visionos/creating-stereoscopic-image-in-visionos

The problems shown in the log are: Undefined symbol: _main Linker command failed with exit code 1 (use -v to see invocation)

The first error seems to say that there's no "main" but there is indeed a @main in the EntryPoint.swift file.

Any ideas? I have archived other apps (built from scratch) successfully, but clearly there's something different about this sample code.

Many thanks!

Answered by funwithstuff in 822388022

Thanks so much for tracking that down. I've been able to Archive my project after rearranging the files in the same way.

However, I can't distribute the app, because "The archive contains nothing that can be signed." Something's clearly a bit funky here, but the app works just fine on-device.

At what stage precisely do you get the error ?

Starting from the VisionOS template, in Xcode 16.2, I was able to Archive (for validation).

I just had to add the icons and give a name that was not yet used.

Thanks very much for trying it out — I've just tried again and it's still failing for me. I've given a unique name and added icons but I'm getting the same error. I am able to archive another app I've been working on, so it's specific to this project.

I get the error when choosing Product > Archive. Running the app works fine, installing to the Vision Pro works fine. I've attached a snap from the failed build log.

Written by funwithstuff in 772974021
The original visionOS sample code has the same issue

This is very strange. I don’t know the cause, but it’s definitely bugworthy.

Consider this:

  1. On macOS 15.2, download the CreatingStereoscopicImageInVisionOS sample.

  2. Unpack it and open the project with Xcode 16.2.

  3. In Signing & Capabilities, select your the team in the Team popup.

  4. Choose Product > Archive; it fails with the error you’re reporting.

  5. In the Project navigator, drag MainView.swift, StereoImage.swift, and StereoImageCreator.swift to the App group, right next to EntryPoint.swift.

  6. Choose Product > Archive. This time it works.

I can’t even begin to speculate as to what’s causing this error, or why step 5 suppresses that error. I’d appreciate you filing a bug about it so that the Xcode team can dig into it.

Please post your bug number, just for the record.

Share and Enjoy

Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"

Thanks so much for tracking that down. I've been able to Archive my project after rearranging the files in the same way.

However, I can't distribute the app, because "The archive contains nothing that can be signed." Something's clearly a bit funky here, but the app works just fine on-device.

I've entered this as FB16395741.

Thanks.

However, I think I've solved it.

Nice!

I showed your bug to one of my DTS colleagues and they showed it to the Xcode team (r. 143521228) who came to the same conclusion. So, there’s at least two Apple bugs here:

  • The build settings in the CreatingStereoscopicImageInVisionOS sample need fixing. Sample code projects should archive by default.

  • Xcode should offer better guidance as to how to fix such things.

The bugs we have an file should be sufficient.

Thanks for your help tracking this down. My DTS colleague, who mostly supports Xcode, has seen weird reports like this in the past but has never been able to nail down a reproducible case.

Share and Enjoy

Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"

Great! Glad I could help and that we found a resolution. Xcode has many buttons and switches, and it's sometimes hard to find the right ones to mess with. Thanks again!

Also, if you (or anyone reading this) have an Apple Vision Pro and you're interested in stereography, here's a TestFlight link to the app that triggered this error: https://testflight.apple.com/join/2eMft2G1

Can build my app but not Archive
 
 
Q