CNSaveRequest without having a container assignment

Hi,

When creating a new contact on MacOS Im getting this new error causing my app to crash, on my app only after updating my machine to Ventura 13.0.

The last error before (lldb) is "An ABCDRecord is being saved without having a container assignment. Assigning the contact to <CNCDContainer 0x6000039b51a0 ab>. Please remember to assign contacts to containers to avoid recurring container lookup and contact re-validation costs."

When saving a new contact I’m using 

saveRequest.add(contact, toContainerWithIdentifier: nil)

            do {

                try contactsStore.execute(saveRequest)

**

I guess it does not like the nil. Am I supposed to add to a particular container, like iCloud? Documentation says to set it to nil - https://developer.apple.com/documentation/contacts/cnsaverequest/1403036-add

Even with the most basic example from https://developer.apple.com/documentation/contacts the save request falis.

Post not yet marked as solved Up vote post of KrtNthnyLn Down vote post of KrtNthnyLn
1.3k views
  • I'm having the same problem. Started with macOS13.0. I have even tried passing in the default container identifier, but it doesn't work.

                [request addContact:createContact toContainerWithIdentifier: [contactStore defaultContainerIdentifier]];

    If you find any resolution, please post it.

Add a Comment

Replies

I am having the same issue. Even passing in the CNContactStore's defaultContainerIdentifier doesn't help, and I get the same the app crashes.

I filed FB11724222 ... hopefully someone from Apple can look into it ASAP.

I might have found a solution... previously I wasn't using the "Contact Notes" entitlements in the macOS app, only on iOS. But with macOS13, I've been getting warnings in Xcode about it, soon "Certificates, Identifiers & Profiles" from the developer portal, I added the "Contact Notes" entitlements to the app identifier and created a manual provisioning profile, then in Xcode I added the "com.apple.developer.contacts.notes" entitlement to the entitlements file, and set the new profile as the developer profile in Xcode. And now it works.

Am still testing some more to confirm the fix, but it might just be that the "container assignment" error is just a misdirection.

  • I will try the contact notes entitlement thing. I don't access a contacts notes and its when I'm creating a new contact the error occurs. [api] **Attempt to write notes by a pre-Fall-2022 app ** [plugin] ..nil group [plugin] ..h: nil group [ABCDContact] An ABCDRecord is being saved without having a container assignment. Assigning the contact to <CNCDContainer 0x60000133a7c0 ab>. (lib) Thread 1: EXC_BAD_ACCESS (code=1, address=0x49f330ba4290)

  • I can't really see in the developer portal under 'Edit your App ID Configuration' to add the Contact Notes entitlement. Can you tell me each step for navigating their site, its recently changed

My issue is CNSaveRequest no longer working in Mac Catalyst app on Ventura 13.0 (22A380), Ive created a simple Mac Catalyst App with a request to Authorise Contacts. Ive added the tick box in the Sandbox section for the app under Contacts. Added a usage description in the .Plist of 'Privacy - Contacts' When creating a new contact using the instructions at https://developer.apple.com/documentation/contacts On Mac Ventura the app just crashes at the execute save request -> Error I get is

2022-10-27 08:22:48.718228+1000 [api] Attempt to write notes by a pre-Fall-2022 app 2022-10-27 08:22:48.755086+1000 [plugin] CDX_AB_GetGroupCollectionPath: nil group 2022-10-27 08:22:48.755139+1000 [plugin] CDX_AB_GetGroupCollectionPath: nil group 2022-10-27 08:22:48.756550+1000 [ABCDContact] An ABCDRecord is being saved without having a container assignment. Assigning the contact to <CNCDContainer 0x60000133a7c0 ab>. Please remember to assign contacts to containers to avoid recurring container lookup and contact re-validation costs.

Thread 1: EXC_BAD_ACCESS (code=1, address=0x49f330ba4290)

I created a simple project showing this error and filed a feedback request with the sample project to apple FB11721907