在我调用getDistance(points [i],points [j])的行上,我收到错误,要求我将getDistance方法参数更改为双精度而不是数组,尽管我认为我将数组传递给方法由于多维数组的工作原理。
AFNetworking
答案 0 :(得分:4)
您的方法$string = "test@me.com,test2@me2.com;test3@me3.com:test4@me4.com;;::test5@me.com"
$separators = ",:;".ToCharArray()
$string.Split($separators,[System.StringSplitOptions]::RemoveEmptyEntries)
将两个参数定义为getDistance
类型,您在其中调用的类型为Array
,但不一样。
重写您的double[]
,如下所示;
getDistance
答案 1 :(得分:2)
您的方法应声明一个数组与您在主数据库中声明的数组相同。
现在:
而不是{
"results" : [
{
"address_components" : [
{
"long_name" : "Old Swan",
"short_name" : "Old Swan",
"types" : [ "sublocality_level_1", "sublocality", "political" ]
},
{
"long_name" : "Liverpool",
"short_name" : "Liverpool",
"types" : [ "locality", "political" ]
},
{
"long_name" : "Liverpool",
"short_name" : "Liverpool",
"types" : [ "postal_town" ]
},
{
"long_name" : "Liverpool",
"short_name" : "Liverpool",
"types" : [ "administrative_area_level_3", "political" ]
},
{
"long_name" : "Merseyside",
"short_name" : "Mersyd",
"types" : [ "administrative_area_level_2", "political" ]
},
{
"long_name" : "England",
"short_name" : "England",
"types" : [ "administrative_area_level_1", "political" ]
},
{
"long_name" : "United Kingdom",
"short_name" : "GB",
"types" : [ "country", "political" ]
},
{
"long_name" : "L13",
"short_name" : "L13",
"types" : [ "postal_code_prefix", "postal_code" ]
}
],
"formatted_address" : "Old Swan, Liverpool, Liverpool, Merseyside L13, UK",
"geometry" : {
"location" : {
"lat" : 53.41419399999999,
"lng" : -2.907765
},
"location_type" : "APPROXIMATE",
"viewport" : {
"northeast" : {
"lat" : 53.42084389999999,
"lng" : -2.8917576
},
"southwest" : {
"lat" : 53.407543,
"lng" : -2.9237724
}
}
},
"place_id" : "ChIJW3JtBYUhe0gRDTIY8Lot-_I",
"types" : [ "sublocality_level_1", "sublocality", "political" ]
}
],
"status" : "OK"
}
应该是:
public double getDistance(Array points1[], Array points2[])