On macOS, my app can't save contacts that have a note

On macOS, an app can’t update a contact that has a note unless it holds a special entitlement, even if it never touches the note. And Apple declined my request for that entitlement.

What happened

Reorder Contacts is an app for reordering phone numbers and email addresses in your contacts. On the Mac, saving failed for some contacts with this error.

NSCocoaErrorDomain 134092

The message only says “Cocoa error 134092”, and nothing about the cause. At first I thought only contacts imported from vCard files failed. Then a user wrote to me that it failed for every contact they tried.

The trigger is a note

I made a small test app that only changes the family name of one contact.

  1. Create a contact from the app. Updating it works.
  2. Add a note to the same contact in Contacts.app. The same update fails with 134092.
  3. Change the note to an empty string. It still fails.
  4. Remove the note property completely. It works again.

So if a contact has a note property, even an empty one, an app without com.apple.developer.contacts.notes can’t update it. It doesn’t matter whether the app requests CNContactNoteKey or not.

vCard import seems to attach a note property even when the vCard has no NOTE line. Contacts.app shows no note, but the framework sees one. That explains both “only vCard contacts fail” and “every contact fails”.

Things that didn’t help:

  • CNContactFetchRequest.mutableObjects instead of mutableCopy()
  • Adding or removing CNContactNoteKey in keysToFetch
  • Removing the sandbox (an ad-hoc signed build fails the same way)

One thing that confused me for a long time: launched from Xcode, the save succeeds. To reproduce it, launch the app from Finder.

What Apple said

  • Feedback Assistant: I filed FB23452026. No reply.
  • Developer Forums: DTS answered in this thread. 134092 is roughly “permission denied”, and yes, the entitlement is needed even if the app never reads or writes notes. They also said the behavior is odd and worth a bug report.
  • Entitlement request: So I requested Contact Notes Field Access. You can’t test it before approval, because an ad-hoc signed build with the entitlement doesn’t even launch.

On October 8, the request was declined. The email said that if an app doesn’t populate the notes field, its updates won’t be rejected. But my test app never touches the note, and the update still fails.

I tried to send the test project to DTS, but the auto-reply said they no longer accept new requests by email, and pointed me back to the forums.

Where it stands

I’m stuck between two answers. DTS says the entitlement is needed. The entitlement review says it isn’t. It’s not solved yet.

In the meantime:

  • The app now explains that the contact has a note and macOS doesn’t allow the change, instead of just showing “Cocoa error 134092”
  • The iPhone and iPad version is not affected

If you get 134092 when saving contacts on the Mac, check whether the contact has a note. And if you have this entitlement and it fixed the problem, I’d like to hear about it.