Xcode 9.4.1 cannot run unit tests for Frameworks on macOS Mojave

Originator:josh
Number:rdar://44945549 Date Originated:2018-10-02
Status:Closed Resolved:Yes
Product:Developer Tools | Xcode Product Version:9.4.1
Classification:Serious Bug Reproducible:Always
 
Summary:
When running unit tests for a Framework, Xcode does not attach to the process and therefore does not run the unit tests.

Steps to Reproduce:
1. Create a Cocoa Touch framework in Xcode in Swift, with "Include Unit Tests" selected
2. Select the iPhone X simulator as the run destination
3. Run unit tests in Xcode with Command-U or Product > Test

Expected Results:
Xcode runs the tests successfully.

Actual Results:
Xcode fails to run the tests at all, and a dialog appears that says "Could not attach to pid : <pid>". The body of the error message says: "Ensure <FrameworkTests> is not already running, and <username> has permission to debug it.

Version/Build:
Xcode 9.4.1 (9F2000)

Configuration:
macOS Mojave 10.14

Notes:
The attached SampleFramework project shows the error. Just run the unit tests on the iPhone X simulator and observe the error.

Comments

Apple has responded with the following:

Thank you for your feedback. Engineering has determined that this issue behaves as intended. This is expected due to debuggability policy changes on Mojave. You can work around this by disabling the debugger in the scheme editor for your Test action, or by moving to Xcode 10.

We are now closing this bug report.

If you just have questions about the resolution, then please update your bug report with that information so we can respond.


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!