'UIApplicationMain' 属性不能在包含顶级代码的模块中使用 [英] 'UIApplicationMain' attribute cannot be used in a module that contains top-level code

查看:33
本文介绍了'UIApplicationMain' 属性不能在包含顶级代码的模块中使用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

突然间我在我的 AppDelegate 中遇到了这个错误:

All of a suden I got this error in my AppDelegate:

'UIApplicationMain' 属性不能在模块中使用包含顶级代码

'UIApplicationMain' attribute cannot be used in a module that contains top-level code

在它说的行中:@UIApplicationMain

现在项目无法构建.我正在使用 Swift 和 Xcode 6.2.我尝试删除派生数据文件夹,甚至使用最新的 Xcode 6.3 beta,这是我第一次创建项目的地方.

Now the project cannot build. I am using Swift and Xcode 6.2. I have tried deleting the derived data folder and even using the latest Xcode 6.3 beta, which was where I first created the project.

我不知道发生了什么,我到处搜索都没有运气.谢谢

I don't know what's going on and I have searched everywhere with no luck. Thank you

推荐答案

好吧,我终于自己解决了.似乎在我添加的名为 main.swift 的库中隐藏了另一个文件,该文件与我的 AppDelegate 冲突.我删除了它,问题就消失了.

Ok, I finally solved it myself. It seems there was another file buried within a library I added called main.swift which was conflicting with my AppDelegate. I deleted it and the issue went away.

这篇关于'UIApplicationMain' 属性不能在包含顶级代码的模块中使用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆