Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/sorting/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
在Swift 2.0中打开带字符串地址的iOS映射_Ios_Dictionary_Swift2_Apple Maps - Fatal编程技术网

在Swift 2.0中打开带字符串地址的iOS映射

在Swift 2.0中打开带字符串地址的iOS映射,ios,dictionary,swift2,apple-maps,Ios,Dictionary,Swift2,Apple Maps,我有字符串格式的地址(不是纬度或经度),不可能从字符串中分离出邮政编码、城市或道路名称 有没有可能用字符串打开地图? 字符串的格式如下所示: 温特图尔8400格吕泽费尔德斯特拉斯塔尔古特福斯巴尔普拉茨酒店 我试过两个例子: 1) 这与swift 2.0中未定义的KabPersonalAddressStreetKey存在问题(这样认为) (二) 这里我没有经纬度。我认为您应该使用CLGeocoder类 以下是apple docs中的示例: 看看这个问题: 它有一个相当详细的答案 /*

我有字符串格式的地址(不是纬度或经度),不可能从字符串中分离出邮政编码、城市或道路名称

有没有可能用字符串打开地图? 字符串的格式如下所示: 温特图尔8400格吕泽费尔德斯特拉斯塔尔古特福斯巴尔普拉茨酒店

我试过两个例子: 1) 这与swift 2.0中未定义的KabPersonalAddressStreetKey存在问题(这样认为)

(二)
这里我没有经纬度。

我认为您应该使用
CLGeocoder

以下是apple docs中的示例:


看看这个问题:

它有一个相当详细的答案

    /*
     Use the CLGeocoder class with a dictionary of Address Book
     information or a simple string to initiate forward-geocoding          
     requests. There is no designated format for string-based 
     requests: Delimiter characters are welcome, but not required, 
     and the geocoder server treats the string as case-insensitive. 
     For example, any of the following strings would yield results:

    "Apple Inc”
    "1 Infinite Loop”
    "1 Infinite Loop, Cupertino, CA USA” 
   */
[geocoder geocodeAddressString:@"1 Infinite Loop"
     completionHandler:^(NSArray* placemarks, NSError* error){
         for (CLPlacemark* aPlacemark in placemarks)
         {
             // Process the placemark.
         }
}];