Probable bug: Removing Standalone target in Projucer-created project causes Xcode crash

Hi

If you create an Xcode project in Projucer with an audio plugin and a Standalone target, then try to remove the Standalone target in Xcode, Xcode will crash. The bug report indicates that this is caused by a bug in Projucer, not Xcode, “[a] common cause of this is corrupt project files which illegally reuse the same target dependency instance for multiple targets”:


Application Specific Information:
ProductBuildVersion: 11C504
ASSERTION FAILURE in /Library/Caches/com.apple.xbs/Sources/IDEXcode3ProjectSupport/IDEXcode3ProjectSupport-15701/Xcode3Core/LegacyProjects/Frameworks/DevToolsCore/DevToolsCore/ProjectModel/DataModel/Containers/PBXContainerItemProxy.m:261
Details: Tried to access the containerPortal of an orphaned container item proxy (Global ID=‘A9D35CB6E84E191FE59B74D5’, Remote Info=‘MyPlugin - Shared Code’). A common cause of this is corrupt project files which illegally reuse the same target dependency instance for multiple targets.
Object: <PBXContainerItemProxy: 0x7fc9cbbb3d00>
Method: -_containerPortal
Thread: <NSThread: 0x7fc9c741c630>{number = 1, name = main}


It probably works if you remove the target in Projucer instead, however it is not feasible for all projects to keep maintaining the project in the Projucer, and the error description indicates that the Projucer is trying to do something illegal, which should be fixed anyway. If you try to remove the dependency before removing the target, the crash happens when you remove the dependency. In my case, I fixed the issue by manually editing the project file in a text editor, and removing the dependency. Projucer v5.4.7, Xcode Version 11.3.1 (11C504).

How are you removing the schemes? If I open Manage schemes... in the scheme dropdown in Xcode and select the Standalone scheme and remove it with the - button Xcode doesn’t complain and the project is fine. I’m using Xcode 11.4.1 so perhaps it has been fixed recently?

I am not removing the scheme, I am removing the target. In the file browser to the left, click on the project logo all the way at the top. Immediately to the right of that pane you should see a pane with “PROJECT” at the top, and “TARGETS” below that. If you select the Standalone target, and click the minus button to remove the target, (or delete button on the keyboard), Xcode crashes.

Thanks, we’ve refactored how the target dependencies are constructed so each PBXTargetDependency has a unique ID, which fixes the crash when removing a target with dependencies. It’s on the juce6 branch here:

1 Like

Thanks, brilliant!