Normal during CNGroup.identifier,
abcdefg1-abc2-abc3-abc4-abcdefg12345
It should be
but if any conditions overlap,
abcdefg1-abc2-abc3-abc4-abcdefg12345:ABGroup:
comes with something unnecessary.
I haven't identified all of these conditions, but is this a bug?
I look forward to hearing from you.
It contains speculation because it is not mentioned in the document, but :ABGroup
suffix is given when it is a locally created group.
The Containers and Groups diagram in Contacts framework makes it easy to see, but there can be multiple CNContact
data sources (=account) that you can retrieve from your contact book.
A user may have contacts in their device's local account and/or server accounts configured to sync contacts.Each account has at least one container of contacts.A contact can be in only one container.
Private Translation: Users can have device local, one of the server accounts on which synchronization is configured, and multiple contact books.Each account has at least one container.The contact book may be a single container.
Contact book data is a collection of various data associated with your device, such as local devices, iCloud, Gmail, Facebook, etc.
An account has one or more collections called CNContainers
.
A group is a set of contacts with a container. Not all accounts support groups and some accounts support groups.
Personal Translation:Group is a set of contact books in a container.Not all accounts support groups, and some accounts support subgroups.
CNGroup
represents this CNContainer
collection of internal contact books
For this reason,
name
)identifier
)identifier
in CNContainer
)I have three pieces of information, but when I store groups in local data, there is no data source or container, so I think I distinguish them by suffix in :ABGroup
.
let saveRequest=CNSaveRequest()
let group = CNMutableGroup()
group.name = "test group"
saveRequest.add(group, toContainerWithIdentifier:nil)
try!self.store.execute(saveRequest)
Thus, if saveRequest.add(_, toContainerWithIdentifier:)
specifies nil
, it is saved locally and :ABGroup
suffix is granted.
When reading externally linked group information, or
let contact=/*Externally linked contacts you want to include in the group*/
let container=try self.store.containers(matching:CNContainer.predicateForContainerOfContact(withIdentifier:contact.identifier))
let containerIdentifier = container.identifier
ABGroup
suffix was not given when toContainerWithIdentifier:
was retrieved from CNContact
other than local data and passed it to toContainerWithIdentifier:
to create a group.
© 2024 OneMinuteCode. All rights reserved.