似乎无法识别CoreLocation

时间:2020-01-14 14:53:46

标签: xcode cocoapods

我最近将可可豆荚安装到xcode中,并在适当的文件中启动了我的项目。我对udemy的学习很快,我们的部分任务是使用库CoreLocation创建天气应用。问题是,xcode似乎无法识别该库。当我按住命令并单击查找定义时,将弹出一个问号。在观看udemy视频的过程中,“我的讲师”可以轻松读取库的定义。这可能是CocoaPods的问题吗?我确定自己写的正确,因为我正在逐字逐句关注视频。

import UIKit

import Corelocation


class WeatherViewController: UIViewController, CLLocationManagerDelegate {

    //Constants
    let WEATHER_URL = "http://api.openweathermap.org/data/2.5/weather"
    let APP_ID = "e72ca729af228beabd5d20e3b7749713"


    //TODO: Declare instance variables here
    let locationManager = CLLocationManager()



    //Pre-linked IBOutlets
    @IBOutlet weak var weatherIcon: UIImageView!
    @IBOutlet weak var cityLabel: UILabel!
    @IBOutlet weak var temperatureLabel: UILabel!


    override func viewDidLoad() {
        super.viewDidLoad()
        locationManager.Delegate = self

1 个答案:

答案 0 :(得分:0)

CoreLocation是Apple框架,因此请确保您具有:

import CoreLocation

在类定义上方,您希望使用此框架的各个部分。

希望有帮助。