Today Extension: View Controller Referenced In Storyboard Not Found At Runtime If Located In Separate Framework Without Direct Code Reference

Originator:michael
Number:rdar://39238390 Date Originated:April 6 2018, 10:50 AM
Status:Duplicate/4691676/Open Resolved:
Product:iOS + SDK Product Version:
Classification:Bug Reproducible:Always
 
Area:
Xcode

Summary:

If you have a today extension, and your MainInterface.storyboard’s primary view controller exists in a separate framework / module, and you make no direct references to that view controller in code within your extension, the extension will successfully install, but will fail to find the view controller at runtime, e.g. with a console log:

> Unknown class _TtC19SharedExtensionCode19TodayViewController in Interface Builder file.

Steps to Reproduce:

1. Extract the sample project.
2. Build the "SharedExtensionCode" scheme.
3. Look at "FixEmptyTarget.swift" for context on the issue.
4. Attempt to run the "Today Extension" target on a simulator or device (you may need to do this twice before it appears).
5. Look at the console in Xcode

Expected Results:

The extension should’ve appeared, displaying "Hello World". 

Actual Results:

The view controller class couldn’t be found, despite being public in another framework, and properly referenced in "MainInterface.storyboard".

A workaround is to make an explicit reference to the view controller type in code. To do this in the sample project, uncomment line 21 of "FixEmptyTarget.swift". Run the extension again and it will work.

Version/Build:

Xcode Version 9.3 (9E145)
Simulator Version 10.0 (SimulatorApp-851.2 CoreSimulator-518.19)
iOS 11.3 (15E217)
Running on macOS High Sierra Version 10.13.4 (17E199)

Configuration:

N/A

Sample Project: https://www.dropbox.com/s/ok3ec4r3y5k6eq1/TodayExtensionIssues%202.zip?dl=0

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!