如何解决$不是函数

时间:2019-05-13 10:49:54

标签: javascript jquery html

尝试上传图片时出现此错误:

  

$不是函数

错误消息来自此处:

let request = MKDirections.Request()


// Get error from this line
let request.source = MKMapItem(placemark:
    MKPlacemark(coordinate:CLLocationCoordinate2D(latitude: 37.325539,
                                                  longitude: -122.011780), addressDictionary: nil))


// Get error from this line
let request.destination = MKMapItem(placemark:
    MKPlacemark(coordinate:CLLocationCoordinate2D(latitude: 37.325539,
                                                  longitude: -122.011780), addressDictionary: nil))

request.transportType = .automobile

let directions = MKDirections.init(request: request)()



// Get error from this line
directions.calculateETA {
    (response, error) -> Void in
    if error == nil {
        if let estimate = response {
            print("Travel time \(estimate.expectedTravelTime / 60)")
            print("Departing at \(estimate.expectedDepartureDate)")
            print("Arriving at \(estimate.expectedArrivalDate)")
        }
    }
}

1 个答案:

答案 0 :(得分:0)

您正确导入了jQuery吗?在控制台中运行此命令,以查看是否获得版本

   $().jquery;