Project doesn't archive, complains about architecture

I have a SwiftUI project, iOS16, it builds fine if I choose a simulator/device, but when I choose Any iOS Device (arm64) and hit Archive, it fails with error:

error build: Entry point (_main) undefined. for architecture arm64

I'm using an M1 Mac Studio to build it.

I have the following in my main:


@main
struct MyAppNameApp: App {

    @UIApplicationDelegateAdaptor(AppDelegate.self) var appDelegate
    ...

}

class AppDelegate: NSObject, UIApplicationDelegate {
    func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey : Any]? = nil) -> Bool {
        // Sets cache for Images downloader SDWebImageSwiftUI
        // ...
        return true
    }
}

Under Architectures I have the following:

Should I select for release Yes as well?

Why is it failing? What setting do I have to look into?

Thanks

Answered by afern247 in 729732022

I found the solution, I had an entry on Development Assets that was not there before, not sure even how it got there, I think I added it by mistake.

Still.... these kind of errors are aweful, Xcode should provide more useful details...

I think you need to pick an actual device to archive something, don't you? It's certainly that way when you want to deploy an iOS app - you have to pick a connected device.

Accepted Answer

I found the solution, I had an entry on Development Assets that was not there before, not sure even how it got there, I think I added it by mistake.

Still.... these kind of errors are aweful, Xcode should provide more useful details...

Project doesn't archive, complains about architecture
 
 
Q