草庐IT

clplacemark

全部标签

ios - '[CLPlacemark] ?' is not convertible to ' [CLPlacemark]' -> swift2

这是我在StackOverflow上找到的部分代码。它在Swift1.2中工作为什么此代码在swift2中不再有效:geoCoder.reverseGeocodeLocation(location,completionHandler:{(placemarks,error)->VoidinletplaceArray=placemarksas[CLPlacemark]//!!!ERRORHERE!!!//PlacedetailsvarplaceMark:CLPlacemark!placeMark=placeArray[0]//Addressdictionaryprint(placeMark

ios - 使用 Swift 4/Xcode 9 从 CLPLacemark 获取完整地址字符串

我以前能够使用以下Swift3代码从CLPlacemark获取完整的地址字符串:letaddressList=placemark.addressDictionary?["FormattedAddressLines"]as?[String]letaddress=addressList!.joined(separator:"\n")addressDictionary现已在swift4中弃用。我可以提取每个单独的CLPlacemark地址变量字符串(名称、国家邮政编码等),但我想知道是否有更简单的方法来做到这一点。我知道有一个CNPostalAddress类型的postalAddress变量

ios - 将 MKMapView 更新为从 CLGeocoder 返回的 CLPlacemark

我希望能够通过允许用户在UIAlertView中输入地址或位置来更新显示在MKMapView上的区域。我目前有:if(geocoder.geocoding)[geocodercancelGeocode];[geocodergeocodeAddressString:[[alertViewtextFieldAtIndex:0]text]completionHandler:^(NSArray*placemarks,NSError*error){if(!error){NSLog(@"Foundalocation");}else{NSLog(@"Erroringeocoding");}NSLog

ios - CLPlacemark.locality,如果设备语言不同,值会改变

我使用CLGeocoder将CLLocation从经度/纬度解码为地名。它工作正常。但是还有一件事困扰着我。当我将设备语言设置为英语时,以下代码的结果:-(void)locationManager:(CLLocationManager*)managerdidUpdateToLocation:(CLLocation*)newLocationfromLocation:(CLLocation*)oldLocation{/*Wereceivedthenewlocation*/NSLog(@"Latitude=%f",newLocation.coordinate.latitude);NSLog(

swift - 'MKMapItem' 不可转换为 'CLPlacemark'

如何在Swift中将MKMapItem转换为CLPlacemark?我的代码给我一个编译器错误'MKMapItem'isnotconvertibleto'CLPlacemark':varmapItems:[MKMapItem]=[]letmi=self.mapItems[indexPath.row];ann.placemark=miasCLPlacemark在ObjC中,我只是做了ann.placemark=(CLPlacemark*)mi; 最佳答案 MKMapItem不是CLPlacemark的子类。我对MapKit不太熟悉,所

iOS - [CLPlacemark 时区] : unrecognized selector iOS 8

我正在使用此方法从lat/long获取timeZone。-(void)getTimeZoneFromLatLong{CLLocation*location=[[CLLocationalloc]initWithLatitude:self.parentVC.currentCity.latitude.doubleValuelongitude:self.parentVC.currentCity.longitude.doubleValue];CLGeocoder*geoCoder=[[CLGeocoderalloc]init];[geoCoderreverseGeocodeLocation:lo

string - 从 CLPlacemark 创建地址字符串

谁能建议清洁工从CLPlacemark创建地址字符串。目前我正在使用这个扩展extensionCLPlacemark{funcmakeAddressString()->String{varaddress=""ifsubThoroughfare!=nil{address=address+""+subThoroughfare!}ifthoroughfare!=nil{address=address+""+thoroughfare!}iflocality!=nil{address=address+""+locality!}ifadministrativeArea!=nil{address=a

ios - 使用自定义值创建 CLPlacemark 以进行测试

我有一个移动CLPlacemark对象并使用它们的应用程序,我想对与它们交互的几个组件进行单元测试。为此,我希望能够使用生成具有已知值的模拟CLPlacemark的方法来阻止MapKit对真正的反向地理定位的调用。CLPlacemark只有一个初始化器(复制初始化器)。但是在documentation,它说:PlacemarkobjectsaretypicallygeneratedbyaCLGeocoderobject,althoughyoucanalsocreatethemexplicitlyyourself.但是,大多数成员都是只读的,因此我不确定如何创建具有自定义值的成员。是否可

ios - 以编程方式/手动创建 MKPlacemark/CLPlacemark

问题我有一组地标信息(国家、城市等)和一对纬度/经度。我想用它来创建一个MKPlacemark对象。讨论看来这个类只能由创建-(id)initWithCoordinate:(CLLocationCoordinate2D)coordinateaddressDictionary:(NSDictionary*)addressDictionary谁的文档状态状态Youcancreateplacemarkobjectsmanuallyforentitiesforwhichyoualreadyhaveaddressinformation,suchascontactsintheAddressBook

ios - CLPlacemark 到 iOS 9 中的字符串

我想将CLPlacemark格式化为字符串。众所周知的方法是使用ABCreateStringWithAddressDictionary,但在iOS9中已弃用。警告告诉我改用CNPostalAddressFormatter。但是,CNPostalAddressFormatter只能格式化CNPostalAddress。无法将CLPlacemark正确转换为CNPostalAddress;只有这3个属性由CLPlacemark和CNPostalAddress共享:country、ISOcountryCode和postalCode.那么现在我应该如何将CLPlacemark格式化为字符串呢?