Cannot archive SwiftUI project, Entry point (_main) undefined. for architecture arm64

Viewed 218

I am using Xcode 12.4 and trying to Archive a SwiftUI App for TestFlight Distribution. The application works without issue on simulator and device, but then trying to archive I get the error:

Entry point (_main) undefined. for architecture arm64

The app is a 100% SwiftUI app. The main app delegate is setup as follows:

@main
struct MyApp: App {
    
    @UIApplicationDelegateAdaptor(AppDelegate.self) var appDelegate
    private let rootControl = LaunchViewControl()
    @Environment(\.scenePhase) private var lifecycle

    init() {
        Logger.log(message: "launch environment: \(AppEnvironmentKey.current)", for: Feature.app)
        //App startup code here
    }
    
    var body: some Scene {
        WindowGroup {
            LaunchView(control: rootControl)
        }
        .onChange(of: lifecycle) { (lifecycle) in
            switch lifecycle {
            case .active:
                Logger.log(message: "active", for: Feature.app)
            case .inactive:
                Logger.log(message: "inactive", for: Feature.app)
            case .background:
                Logger.log(message: "background", for: Feature.app)
            @unknown default:
                Logger.log(message: "unknown: \(lifecycle)", for: Feature.app, level: .warning)
            }
        }

    }
    
}

class AppDelegate: NSObject, UIApplicationDelegate, UISceneDelegate {
    
    func application(_ application: UIApplication,
                     didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey : Any]? = nil) -> Bool {
        Logger.log(message: "launch", for: Feature.app)
        return true
    }
        
    func applicationDidReceiveMemoryWarning(_ application: UIApplication) {
        Logger.log(message: "memory warning", for: Feature.app, level: .warning)
    }
    
    func applicationWillTerminate(_ application: UIApplication) {
        Logger.log(message: "terminated", for: Feature.app)
    }
    
}

Note sure if relevant, but I've had to turn Bitcode off for this app as a third party framework we are using does not support it.

What is going wrong and how can I get this to archive?

0 Answers
Related