Has anyone encountered a situation like mine below? I’ve submitted feedback, but it seems like I’ll have to wait for a while.
ContactProviderManager Fails with Custom domainIdentifier, Works Only with "defaultDomain"
Category: Developer Tools / Frameworks Subcategory: ContactProvider Framework Reproducibility: Always iOS Version: iOS 18.0 (and later) Xcode Version: Xcode 16.0 (or later)
Description: When initializing a ContactProviderManager with a custom ContactProviderDomain using any identifier other than "defaultDomain", the initializer throws a ContactProviderError.domainNotRegistered error. The documentation for ContactProviderDomain (https://developer.apple.com/documentation/contactprovider/contactproviderdomain) does not provide any method to register custom identifiers, making it impossible to use ContactProviderManager with a desired custom identifier. The only successful case is when the identifier is "defaultDomain". print("Error: (error)") // No error, initialization succeeds
Steps to Reproduce:
-
Create a Contact Provider Extension in an iOS app targeting iOS 18.0.
-
In host app, Attempt to initialize a ContactProviderManager with a custom ContactProviderDomain identifier:
import ContactProvider
func enableExtensionExample() async {
do {
// The app creates a contact provider manager with custom domain.
let manager = try ContactProviderManager(domainIdentifier: "com.mycompany.customdomain")
// May prompt the person to enable the custom domain.
try await manager.enable()
} catch {
print("Error: \(error)") // Prints ContactProviderError.domainNotRegistered
}
}
- Try the same with the default identifier:
import ContactProvider
func enableExtensionExample() async {
do {
// The app creates a contact provider manager with a default domain.
let manager = try ContactProviderManager(domainIdentifier: "defaultDomain")
// May prompt the person to enable the default domain.
try await manager.enable()
} catch {
print("Error: \(error)") // No error, initialization succeeds
}
}
-
Build and run the app on a device or simulator running iOS 18.0 or later.
-
Observe that the initializer fails with domainNotRegistered for any identifier other than "defaultDomain".
Expected Behavior:
The ContactProviderManager should initialize successfully with any valid ContactProviderDomain identifier, provided the domain is properly configured or registered, allowing developers to use custom identifiers for organizing contacts (e.g., for different categories or sources).
Actual Behavior:
The ContactProviderManager initializer throws ContactProviderError.domainNotRegistered for any ContactProviderDomain identifier other than "defaultDomain". Only the "defaultDomain" identifier succeeds, limiting the ability to use custom domains.
Impact:
Developers cannot use custom identifiers to categorize or manage contacts in separate domains, restricting the ContactProvider framework’s flexibility. This forces reliance on the "defaultDomain" identifier, which may not suit use cases requiring distinct contact groups (e.g., personal vs. business contacts).
Suggested Fix:
Provide an API to register custom ContactProviderDomain identifiers, such as a ContactProviderManager.register(domain:) method. Update the ContactProviderDomain and ContactProviderManager documentation to clarify how to use custom identifiers or explicitly state if only "defaultDomain" is supported. If custom identifiers are not intended to be supported, document this limitation clearly to avoid developer confusion.
Feedback : FB20104001 (ContactProviderManager Fails with Custom domainIdentifier, Works Only with "defaultDomain")