CLPlacemark Initializer With CNPostalAddress Doesn't Persist SubLocality
Originator: | adam.kuipers | ||
Number: | rdar://44949512 | Date Originated: | October 2 2018 |
Status: | Open | Resolved: | |
Product: | iOS + SDK | Intents Framework; Intents Framework | Product Version: | iOS 12 |
Classification: | Bug | Reproducible: | Yes |
Area: Intents Framework Summary: The Intents framework adds a convenience initializer to `CLPlacemark`—`.init(location: name: postalAddress)`. When the postal address has a subLocality the initialized placemark will not save that subLocality. See the attached playground for example. Steps to Reproduce: - Create a CNPostalAddress with a subLocality. - Create a CLPlacemark with the `.init(location: name: postalAddress)` initializer. - Read `CLPlacemark.sublocality` or `CLPlacemark.postalAddress?.sublocality`. Expected Results: CLPlacemark's subLocality equals CNPostalAddress' subLocality. Actual Results: CLPlacemark's subLocality is an empty string. Version/Build: XCode 10.0; iOS 12.0 or macOS 10.14 (18A391) Configuration: Fails with any configuration. ==ATTACHED PLAYGROUND== import Cocoa import CoreLocation import Contacts import Intents var str = "Hello, playground" let expectedSubLocality = "EXPECTED_SUB_LOCALITY" let postalAddress = CNMutablePostalAddress() postalAddress.street = "1 Infinite Loop" postalAddress.city = "Cupertino" postalAddress.state = "CA" postalAddress.postalCode = "95014" postalAddress.subLocality = expectedSubLocality assert(postalAddress.subLocality == expectedSubLocality) let location = CLLocation(latitude: -52, longitude: -42) let placemark = CLPlacemark(location: location, name: "TEST", postalAddress: postalAddress) assert(placemark.subLocality == expectedSubLocality || placemark.postalAddress?.subLocality == expectedSubLocality)
Comments
Please note: Reports posted here will not necessarily be seen by Apple. All problems should be submitted at bugreport.apple.com before they are posted here. Please only post information for Radars that you have filed yourself, and please do not include Apple confidential information in your posts. Thank you!