Post not yet marked as solved
Post marked as unsolved with 0 replies, 195 views
I'm working on a standalone watchOS app that will just display my iCloud contacts and contact groups (I have about 10 groups). After reading through the documentation on the Contacts framework, I'm running into an issue getting my groups recognize correctly on my watch. When I query the CNContactStore for containers, I get a single local Container. When I use the identifier for that container to query for groups, I get array with over 18,000 objects that I can't interact with (the app crashes if I try to access in individual element. I'm just curious if anyone has run into anything like this, or if I'm missing anything in the docs. Any help is appreciated. Relevant code below private var _contactsStore: CNContactStore? = CNContactStore()
//This returns a single container, and I store the identifer
let containers = try _contactsStore?.containers(matching: nil)
//I use the identifier of the local container here, and get over 18,000 objects returned
let contactGroups = try _contactsStore!.groups(matching:
CNGroup.predicateForGroupsInContainer(withIdentifier: containerIdentifier))