Domains are not set during NSFileProviderExtension’s initialization

Originator:bogo
Number:rdar://33845462 Date Originated:2017-08-10
Status:Open Resolved:
Product:iOS Product Version:11b5
Classification: Reproducible:
 
# Description:
When the NSFileProviderExtension object is instantiated, it is created with a nil domain. The domain is only set on the object subsequently. This uncertainty impacts ability to leverage NSFileProviderDomains as a useful multitenancy mechanism.

# Steps to repro:
1. Implement rudimentary support for a File Provider in the project
2. Add new NSFileProviderDomains via the NSFileProviderManager
3. Break during the instantiation of the NSFileProviderExtension
4. Inspect contents of self.domain

# Expected Results:
Inspecting the contents of self.domain yields the domain for which the instance of NSFileProviderExtension was created.

# Observed Results:
self.domain is a nil pointer

# Additional Notes:
Since instances of NSFileProviderExtension are generally meant to be stateless and thus are not guaranteed a lifecycle of calls beyond init, we are unable to deterministically define and bootstrap our domain. Instead, we are forced to either:

1. Observe the contents of self.domain for mutations, meaning that we might either have to:
2. a) bleed an action/enumeration call,
3. b) cache action/enumeration calls until domain is determined;
4. Prefix every external method to resolve the domain, hoping it has been set between instantiation and the method call - we have observed this to not always be true.

This issue could be resolved by having the class owning the NSFileProviderExtension preset the domain property on each new instance of NSFileProviderExtension as a part of its instantiation call. Alternatively, a strong guarantee about the order of methods should be made in the documentation, or a bona fide configuration method could be exposed. (akin to viewDidLoad)

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!