Today Extension With No Linked Files Causes App To Fail To Install In Simulator

Originator:michael
Number:rdar://39237943 Date Originated:April 6 2018, 10:50 AM
Status:Closed Resolved:Closed. Engineering has determined that this issue behaves as intended.
Product:iOS + SDK Product Version:
Classification:Bug Reproducible:Yes
 
If a Today Extension only includes the main storyboard, and all other associated files exist in a separate module / framework, building and running either the host app or the extension target in the simulator produces the error in Xcode: "This app could not be installed at this time."

Further investigation in `mobile_installation.log.0` reveals that the appex could not be found. From the attached samples:

Fri Apr  6 10:12:44 2018 [1240] <err> (0x700008a06000) copy_entitlements_for_path: Unable to load entitlements from "/Users/Michael/Library/Developer/CoreSimulator/Devices/51417E58-232D-45D5-9DAB-EB4C6F0AA301/data/Library/Caches/com.apple.mobile.installd.staging/temp.jgeydh/extracted/Payload/TodayExtensionIssues.app/PlugIns/TodayExtension.appex/TodayExtension": (-2) No such file or directory

Steps to Reproduce:

You can used the attached sample project ("TodayExtensionIssues") and skip to step 16, but here’s how we set this up.

1. In Xcode, File > New Project
2. Single View App
3. Name the project
4. File > New > Target…
5. Today Extension
6. Name the today extension
7. File > New > Target…
8. Cocoa Touch Framework
9. Name the framework
10. Change the "Require Only App-Extension-Safe API" Build Setting on this framework from "No" to "Yes".
11. Run the extension scheme on any simulator (sometimes you need to run it twice for the new extension to appear) and verify that the today extension displays "Hello World", which is the default UI.
12. In Xcode, move `TodayViewController.swift` from the today extension target to the new cocoa touch framework target.
13. In MainInterface.storyboard, select "Today View Controller" in the outline view, and open the identity inspector. Uncheck "Inherit Module From Target", and retype "TodayViewController" in the "Class Field". When exiting the field, "Module" should fill in to whatever you named your framework.
14. In TodayViewController.swift, make `TodayViewController` public.
15. Clean the project build folder with Shift+Option+Command+K. This is important, as not doing so will not reproduce the issue since the extension may exist on disk from testing it earlier.
16. Try to run either the host app or the extension from Xcode in any simulator.

Expected Results:

The application should launch fine. If the extension is installed, it should display "Hello World".

Actual Results:

Xcode displays a message: "This app could not be installed at this time." Also see the note about `mobile_installation.log.0` above.

To fix this, you must link at least one source file to the extension target, even if it’s empty. Then, the application will successfully install in the simulator.

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/ih31x7c7sj50ivr/TodayExtensionIssues.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!