How to build iPhone App on mac

Reference

Creating a Mac Version of Your iPad

Error Message

‘AppDelegate’ is annotated with @main and must provide a main static function of type () -> Void or () throws -> Void.

Solution

import UIKit

@main
class AppDelegate: UIResponder, UIApplicationDelegate {

// Add following five lines of code to AppDelegate.swift
    #if targetEnvironment(macCatalyst)
    static func main() {
      UIApplicationMain(CommandLine.argc, CommandLine.unsafeArgv, nil, NSStringFromClass(AppDelegate.self))
    }
    #endif

投稿者: admin

Free Software Engineer

コメントを残す

メールアドレスが公開されることはありません。 が付いている欄は必須項目です