Host apps can interfere with the tint color of extensions they are invoking

Originator:michaelhochs
Number:rdar://30141950 Date Originated:23-Jan-2017 11:30 AM
Status:Behaves correctly Resolved:
Product:iOS Product Version:10.2
Classification:Serious Bug Reproducible:Always
 
Summary:
When a host app configures a views tintColor by setting it through `UIAppearance`, this also populates in to any extensions this app invokes. With this you can change the look of the UI of out of process views, both for system extensions and 3rd party extensions.

Steps to Reproduce:
- Open the attached sample project and run it either on device or simulator
- Note the `UIAppearance` call in `-[AppDelegate init]`
- Tap the share button
- Choose an extension to share the content with. E.g. Messages, Twitter, Add To iCloud Drive or any other extension. This works with almost all extensions.

Expected Results:
- The extension looks like it would without setting the app delegate. So e.g. Messages or iCloud Drive would have it’s usual blue tint color set on buttons.

Actual Results:
- The tint color in the extensions also is green like the one in the host app.

Regression:
This seems to work mit almost all extensions. The only extensions I tried that didn’t suffer from this bug are Microsoft OneNote and Notes. Mail seems to work at first, as the buttons in the bar are blue, but as soon as you tap on ‘Cancel’, the presented action sheet picks up the wrong tint color as well.
Another important thing here is: Setting a custom tintColor in the action extension does not fix this issue. I haven’t found any way to override the tint color set from the host app inside my own action extension.

Notes:
I am reporting that not because I want to set my tint color like this and than have the extensions look okay, but its more like the other way around. I am working on an Action Extension and I want my tintColor to look okay. With this bug, an Action Extension would basically need to be build in a way that it works with any tint color, even with colors like white.

Comments

Workaround

Apparently this issue can be worked around by specifying NSExtensionOverridesHostUIAppearance=YES in the NSExtension dictionary of the extensions Info.plist.

By michaelhochs at Jan. 23, 2017, 11:24 a.m. (reply...)

Sample Code

https://github.com/PSPDFKit-labs/radar.apple.com/tree/master/30141950%20-%20HostAppTintColorInterfereWithExtensions

By michaelhochs at Jan. 23, 2017, 10:33 a.m. (reply...)

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!