我试图使用重大更改位置服务。我在OS Mavericks上使用Swift和XCode。我正试图增强一个iOS应用程序,这是我在教程之后构建的。类型'AppDelegate'不符合协议'CLLocationManagerDelegate' - Xcode 6中的Swift
在我AppDelegate.swift
文件我已经创建了下面的方法来初始化我的位置管理服务:
func initializeLocationManager() {
// instance of location manager class
var locationManager = CLLocationManager()
locationManager.delegate = self // error here
locationManager.desiredAccuracy = kCLLocationAccuracyKilometer
locationManager.requestAlwaysAuthorization()
locationManager.startUpdatingLocation()
}
但在代码的第4行,我得到一个错误说:
类型“ AppDelegate的”不符合协议‘CLLocationManagerDelegate’
为什么会出现这个错误?我该如何解决?任何帮助将不胜感激。
谢谢。