【问题标题】:What Has Replaced the "main.m" File in Xcode 6.3 [duplicate]Xcode 6.3 中替换了“main.m”文件的内容 [重复]
【发布时间】:2015-05-22 15:56:41
【问题描述】:

根据 IOS 开发人员库:https://developer.apple.com/library/ios/referencelibrary/GettingStarted/RoadMapiOS/FirstTutorial.html

ma​​in.m 中的 main 函数调用自动释放池中的 UIApplicationMain 函数。

但是,在 XCode 6.3 中,似乎不再有“main.m”文件。 什么替换了“main.m”文件?

谢谢。

【问题讨论】:

标签: swift appdelegate xcode6.3


【解决方案1】:

您的标签表明您使用的是 Swift,而不是 Objective-C。 Swift 使用不同的机制来启动你的程序。一般来说,它不需要main 函数,因为编写不包含在函数中的代码是合法的。

Swift 项目模板tags the NSApplicationDelegate implementation with @NSApplicationMain (or @UIApplicationMain on iOS)。这告诉编译器生成一个调用NSApplicationMainmain 函数。

【讨论】:

    猜你喜欢
    • 2014-09-26
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2015-10-01
    • 1970-01-01
    • 1970-01-01
    • 2017-08-10
    相关资源
    最近更新 更多