CNContactStore.defaultContainerIdentifier always returns iCloud container in Sandboxed app
| Originator: | agiletortoise | ||
| Number: | rdar://30348690 | Date Originated: | 03-Feb-2017 10:16 AM |
| Status: | Open | Resolved: | |
| Product: | macOS SDK | Product Version: | |
| Classification: | Serious Bug | Reproducible: | Always |
Area: Contacts Summary: When calling CNContactStore.defaultContainerIdentifier, the current user's default contact account identifier, as configured in the Contacts.app preferences, should be returned. In a non-sandboxed app, this works and correctly returns the default account, regardless of type (CardDAV, Exchange, etc.) or host (Google, Other). If Sandboxing is enabled (with "Contacts" checked in App Data) in app's entitlements, the call to CNContactStore.defaultContainerIdentifier always returns the identifier for the user's iCloud container. **Even if Contacts and turned off for the iCloud Account** Similarly, CN*Requests which specify a nil container, are passed to the iCloud container - again **Even if Contacts and turned off for the iCloud Account**. e.g. an add request will create a new contact in iCloud which is not even visible to the user because contacts are disabled. In the same Sandboxed app, calls which create a contact using the old ABAddressBook API correctly create the new contact in the user's default container. Steps to Reproduce: 1. Open attachment. 2. Open Contacts.app. Change default contacts account to something other than iCloud. 3. Run "BUG_NoSandbox" sample project, look at console output-correct default contact container will be reported as default. 4. Run "BUG_Sandbox" sample project, look at console output-iCloud contact container will be reported as default, even though it is not. 5. Go to System Preference, uncheck "Contacts" for iCloud. 6. Run "BUG_Sandbox" sample project, look at console output-iCloud contact container will be reported as default, even though it is not and should not even be enabled and available. Expected Results: Even in Sandboxed app, the user's correct default contact container should be reported. Actual Results: In Sandboxed app, iCloud is always reported as default Contact container - even if iCloud has Contacts disabled. Version: macOS 10.12.3 (16D32) Notes: Configuration: Attachments: 'Archive.zip' was successfully uploaded.
Comments
Please note: Reports posted here will not necessarily be seen by Apple. All problems should be submitted at bugreport.apple.com before they are posted here. Please only post information for Radars that you have filed yourself, and please do not include Apple confidential information in your posts. Thank you!