我最近升级了Xcode并尝试继续编程。我的应用无法构建。它说问题出在AppDelegate中。 我复制了我的代码:
import UIKit
@UIApplicationMain
AppDelegate: UIResponder, UIApplicationDelegate {
var window: UIWindow?
func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool {
// Override point for customization after application launch.
let storyboard = UIStoryboard(name: "Main", bundle: NSBundle.mainBundle())
let defaults = NSUserDefaults.standardUserDefaults()
var rootViewController : UIViewController;
if (defaults.boolForKey("HasBeenLaunched")) {
// This gets executed if the app has ALREADY been launched
rootViewController = storyboard.instantiateViewControllerWithIdentifier("maintabcontroller") as UIViewController
} else {
// This gets executed if the app has NEVER been launched
defaults.setBool(true, forKey: "HasBeenLaunched")
defaults.synchronize()
rootViewController = storyboard.instantiateViewControllerWithIdentifier("setupstory") as UIViewController
}
window?.rootViewController = rootViewController;
window?.makeKeyAndVisible();
UITabBar.appearance().barTintColor = UIColor.whiteColor()
UITabBar.appearance().tintColor = UIColor.blackColor()
return true
}
}
错误在AppDelegate: UIResponder, UIApplicationDelegate {
行中。他们是:
在升级之前,我没有收到所有这些错误。
答案 0 :(得分:1)
您意外删除了class
关键字:
@UIApplicationMain
class AppDelegate: UIResponder, UIApplicationDelegate {