我有一个方向ap,但我对'directionsusinggoogle'错误的成员不明确。它使用google places api来计算方向等。这是我的代码。这是错误的图像。
<?php
$con=mysqli_connect("localhost","huj","huj","emails");
// Check connection
if (mysqli_connect_errno()) {
echo "Failed to connect to MySQL: " . mysqli_connect_error();
}
// escape variables for security
$firstname = mysqli_real_escape_string($con, $_POST['name']);
$sql="INSERT INTO emails (email)
VALUES ('$firstname')";
if (!mysqli_query($con,$sql)) {
die('Error: ' . mysqli_error($con));
}
echo "1 record added";
mysqli_close($con);
?>
答案 0 :(得分:2)
假设您使用https://github.com/varshylmobile/MapManager/blob/master/MapManager.swift并将其转换为 Swift 3 ,则API具有以下签名:
func directionsUsingGoogle(from:NSString, to:NSString,
directionCompletionHandler:DirectionsCompletionHandler)
func directionsUsingGoogle(from:CLLocationCoordinate2D, to:CLLocationCoordinate2D,
directionCompletionHandler:DirectionsCompletionHandler)
func directionsUsingGoogle(from:CLLocationCoordinate2D, to:NSString,
directionCompletionHandler:DirectionsCompletionHandler)
注意NSString
,因此:
mapManager.directionsUsingGoogle(
from: txtFrom.text! as NSString,
to: txtTo.text! as NSString,
directionCompletionHandler: {(
_ route:MKPolyline?,
_ directionInformation:NSDictionary?,
_ boundingRegion:MKMapRect?,
_ error:String?) in
...
}
)