Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/url/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Swift2 使用未解析标识符“CLLocationCoordinate2D”_Swift2_Cllocationcoordinate2d - Fatal编程技术网

Swift2 使用未解析标识符“CLLocationCoordinate2D”

Swift2 使用未解析标识符“CLLocationCoordinate2D”,swift2,cllocationcoordinate2d,Swift2,Cllocationcoordinate2d,在尝试构建数据时,我一直在使用未解析的标识符“CLLocationCoordinate2D”。这是一个保存数据的类,它附加了一个数组,稍后我将在Map和TableViewController中使用该数组。你知道我为什么会犯这个错误吗 进口基础 导入UIKit 导入CoreData class StationsData: NSObject { //define the varibles init () { } var stations: [StationItem]

在尝试构建数据时,我一直在使用未解析的标识符“CLLocationCoordinate2D”。这是一个保存数据的类,它附加了一个数组,稍后我将在Map和TableViewController中使用该数组。你知道我为什么会犯这个错误吗

进口基础 导入UIKit 导入CoreData

class StationsData: NSObject {
    //define the varibles
    init () {

    }
    var stations: [StationItem]


    //initiate the array and assig the values to the array
        required init(coder aDecoder: NSCoder) {

            stations = [StationItem]()

            let row0 = StationItem(title: "Station1", address: "25 Israel Eldad St, Jerusalem", coordinate: CLLocationCoordinate2D(latitude: 31.7513239, longitude: 35.224822899999936))
            stations.append(row0)

            let row1 = StationItem(title: "Station2", address: "25 Israel Eldad St, Jerusalem", coordinate: CLLocationCoordinate2D(latitude: 0.0, longitude: 0.0))
            stations.append(row1)

            let row2 = StationItem(title: "Station3", address: "25 Israel Eldad St, Jerusalem", coordinate: CLLocationCoordinate2D(latitude: 0.0, longitude: 0.0))
            stations.append(row2)

            let row3 = StationItem(title: "Station4", address: "25 Israel Eldad St, Jerusalem", coordinate: CLLocationCoordinate2D(latitude: 0.0, longitude: 0.0))
            stations.append(row3)

            let row4 = StationItem(title: "Station5", address: "25 Israel Eldad St, Jerusalem", coordinate: CLLocationCoordinate2D(latitude: 0.0, longitude: 0.0))
            stations.append(row4)

            super.init(coder: aDecoder)!
    }
}

您应该包括Mapkit导入Mapkit。

您应该包括Mapkit导入Mapkit