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

Accepted Reply

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...

Replies

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.

  • nah, where did you hear that? lol That's not true

  • Yeah, "lol"... :roll eyes: If you select a simulator target such as "iPhone 14 Pro Max", the "Archive" option is disabled. That's where I got it from.

Add a Comment

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...