Can iPhone App access the Notes field in the Contact Book (assuming user allows access to contacts)

StackOverflow https://stackoverflow.com/questions/23415806

  •  13-07-2023
  •  | 
  •  

Can an iPhone App access the notes field in the Contact Book? I am assuming that the user has permitted the app to allow access to "Contacts" when prompted.

Can all available fields in Contacts be accessed?

有帮助吗?

解决方案

Yes, you get the note value like you would for the other properties. For example, you can use ABRecordCopyValue with the kABPersonNoteProperty. See the Address Book Programming Guide for iOS, notably the Direct Interaction: Programmatically Accessing the Database chapter.

For example, to get the last name, you would:

NSString *name = CFBridgingRelease(ABRecordCopyValue(person, kABPersonLastNameProperty));

To get the note, you would:

NSString *note = CFBridgingRelease(ABRecordCopyValue(person, kABPersonNoteProperty));

See the Constants section of the ABPerson Reference for a list of the properties that can be retrieved.

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top