找回swift main入口函数

2019-01-27  本文已影响0人  yunie
本文适配xcode10.1

1. 新建一个main.swift文件,在其中添加如下代码


import Foundation
import UIKit

private let pointer = UnsafeMutableRawPointer(CommandLine.unsafeArgv).bindMemory(
    to: UnsafeMutablePointer<Int8>.self,
    capacity: Int(CommandLine.argc)
)

UIApplicationMain(
    CommandLine.argc,
    pointer,
    NSStringFromClass(UIApplication.self),
    NSStringFromClass(AppDelegate.self)
)

2. 注释Appdelegate中的@UIApplicationMain

//@UIApplicationMain
上一篇 下一篇

猜你喜欢

热点阅读