-1
我从这里下载了一个示例代码,用于位置跟踪应用程序https://www.pubnub.com/blog/2015-05-05-getting-started-ios-location-tracking-and-streaming-w-swift-programming-language/。我试图运行该应用程序,但在AppDelegate类中,我收到一个错误,说“类AppDelegate没有初始化器”。什么导致这个错误,我该如何解决它?类AppDelegate没有初始化器
import UIKit
@UIApplicationMain
class AppDelegate: UIResponder, UIApplicationDelegate {
// MARK: - Properties
//var window: UIWindow?
var window = UIWindow(frame: UIScreen.mainScreen().bounds)
// MARK: - App Life Cycle
func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool {
// Adding a Navigation Controller and tool bar
self.window.rootViewController = UINavigationController(rootViewController: MainViewController(nibName: nil, bundle: nil))
// Make window visible
self.window.makeKeyAndVisible()
return true
}
}
以编程方式添加根视图控制器,实际上所有的代码你有'AppDelegate'吗?除了window之外还有其他的属性吗? – rmaddy
是的,这就是源代码中的所有内容。 – user7770817
请在问题中复制并粘贴编译器给您的* exact *错误。谢谢! –