Questions tagged [cnpostaladdress]

The CNPostalAddress class is a representation of the postal address for a contact, available for iOS, macOS and watchOS.

CNPostalAddress is an immutable representation of the postal address for a contact. It has a mutable subclass, CNMutablePostalAddress.

6 questions
19
votes
2 answers

Create CNPostalAddress from known values

I am trying to create a CNPostalAddress with some strings in Objective-C. I have street address, city, state, zip and country values. I have tried the code below but it’s not working. Thanks for your valuable time. CNPostalAddress *postalAddr =…
SRI
  • 1,514
  • 21
  • 39
5
votes
1 answer

How can I create a CNContact with a CNPostalAddress?

I tried this: let contact = CNMutableContact() contact.namePrefix = data["firstName"] as! String contact.nameSuffix = data["lastName"] as! String contact.organizationName = data["company"] as! String contact.jobTitle =…
Sebastian
  • 6,154
  • 5
  • 33
  • 51
4
votes
2 answers

How to localize an international address especially thoroughfare and subthoroughfare

I'm working on an app that heavily uses addresses in different countries. We have a bunch of ways we input them from getting addresses imported, to dropping pins on map, to reverse geocode our current location. My current project is to correctly…
AdamAM
  • 71
  • 4
3
votes
2 answers

Saving a CNPostalAddress in Objective-C

I have this code: CNMutablePostalAddress *postalAddress = [[CNMutablePostalAddress alloc] init]; [postalAddress setCity:@"City"]; CNLabeledValue *city = [CNLabeledValue labeledValueWithLabel:CNPostalAddressCityKey…
David
  • 69
  • 1
  • 9
1
vote
0 answers

How to get postal address id from a contact iOS swift 5

i'm fetching contacts from iphone with complete contact detail i have recieved address and address label store with it but i want id of that address. for postalAddress in contact.postalAddresses { let title: String = …
0
votes
1 answer

Is there a clean way to convert a CNPostalAddress to a CNMutablePostalAddress?

I want to modify the values of a CNPostalAddress, which I obtained from the postalAddress property of a CLPlacemark. Since CNPostalAddress has immutable properties, I want to convert it to a CNMutablePostalAddress. However, there doesn't seem to be…
Tamás Sengel
  • 55,884
  • 29
  • 169
  • 223