Skip to content

Embed watchOS apps in PlugIns directory for Xcode 16+ - #1614

Open
BigBalli wants to merge 2 commits into
yonaskolb:masterfrom
BigBalli:fix/watchos-plugins-embed
Open

BigBalli wants to merge 2 commits into
yonaskolb:masterfrom
BigBalli:fix/watchos-plugins-embed

Conversation

@BigBalli

@BigBalli BigBalli commented Apr 2, 2026

Copy link
Copy Markdown

Summary

Starting with Xcode 16, watchOS apps must be embedded in the parent app bundle's PlugIns/ directory instead of the legacy Watch/ directory. Without this change, installing on device fails with:

MyWatchApp.app is a Foundation extension and must be embedded in the parent
app bundle's PlugIns directory, but is embedded in the parent app bundle's Watch directory.

Changes

In PBXProjGenerator.swift, the "Embed Watch Content" copy phase now checks the project's xcodeVersion:

  • Xcode 16+: dstSubfolderSpec = .plugins (13), dstPath = ""
  • Xcode < 16: dstSubfolderSpec = .productsDirectory (16), dstPath = "$(CONTENTS_FOLDER_PATH)/Watch" (unchanged)

Test plan

  • Existing tests pass (the test fixture uses the default xcodeVersion 14.3, so it continues to use the legacy Watch/ embedding)
  • Verified with a real watchOS project on Xcode 26.4 that the generated project installs correctly on device

Fixes #1613

BigBalli and others added 2 commits April 2, 2026 11:35
Starting with Xcode 16, watchOS apps must be embedded in the parent
app bundle's PlugIns/ directory (dstSubfolderSpec=13) instead of the
legacy Watch/ directory (dstSubfolderSpec=16). Gate the behavior on
xcodeVersion so older projects continue to work.

Fixes yonaskolb#1613

Copy link
Copy Markdown
Owner

Thanks for digging into this @BigBalli, and for the clear repro in #1613.

I've merged the latest master into this branch so CI runs again. One thing has changed since you opened this: master now defaults xcodeVersion to 16.0 (#1658). With this check that means every project gets PlugIns embedding by default, including legacy application.watchapp2 targets (like App_watchOS in the TestProject fixture), which still need to live in Watch/.

Could we gate this on the watch target's type instead of xcodeVersion? e.g. only use .plugins for single-target watchOS application targets and keep Watch/ for watchapp2. It would also help to know what a fresh Xcode 26 iOS + watch app template generates for its "Embed Watch Content" phase, since as far as I know it still uses $(CONTENTS_FOLDER_PATH)/Watch; if that's right, the install error might be coming from something else in the watch target (e.g. an NSExtension key in its Info.plist).

A test covering the new path and a CHANGELOG entry under Next Version would be great too.


Generated by Claude Code

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

watchOS app embedded in Watch/ instead of PlugIns/ — fails on Xcode 26

2 participants