Build warning after migrating watchOS project to single target in Xcode 14

I have an iOS app with an independent watchOS app.

With Xcode 14, I migrated the project to only use a single target for watchOS (i.e. remove the "extension" target).

Everything builds, but I get the following build warning:

appName.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.

where "appName" is the product name of the watchOS target.

I tried the following, to no avail:

  • restart Xcode
  • restart computer
  • clean build folder
  • delete derived data

Any ideas?

Accepted Reply

Can you check your watch app's Info.plist to make sure there are no references to NSExtension?

  • Thank you for the tip. The Info.plist did indeed contain a reference to NSExtension. However, having deleted it, I now get the following build error:

    Couldn't load Info dictionary for DVTFilePath:0x6000000b42a0:'/Users/userName/Library/Developer/Xcode/DerivedData/appName-dgsfediuxlxwolgiudftjdxvvemi/Build/Products/Debug-iphonesimulator/appName.app/Watch/appName.app'

    Deleting derived data did not fix this error.

  • After a bit more testing, the build only succeeds if I FIRST build for watchOS, and SECOND for iOS. Otherwise, iOS build returns the error:

    .../Xcode/DerivedData/AppName-dgsfediuxlxwolgiudftjdxvvemi/Build/Products/Debug-watchos/AppNameWatch.app: No such file or directory.

    I suspect this is related to how the iOS and watchOS targets are related to each other. Building for a physical iOS device fails every time.

  • I found the issue: for some reason, the watchOS target was missing from Target dependencies of the iOS target. Solved!

Add a Comment

Replies

Can you check your watch app's Info.plist to make sure there are no references to NSExtension?

  • Thank you for the tip. The Info.plist did indeed contain a reference to NSExtension. However, having deleted it, I now get the following build error:

    Couldn't load Info dictionary for DVTFilePath:0x6000000b42a0:'/Users/userName/Library/Developer/Xcode/DerivedData/appName-dgsfediuxlxwolgiudftjdxvvemi/Build/Products/Debug-iphonesimulator/appName.app/Watch/appName.app'

    Deleting derived data did not fix this error.

  • After a bit more testing, the build only succeeds if I FIRST build for watchOS, and SECOND for iOS. Otherwise, iOS build returns the error:

    .../Xcode/DerivedData/AppName-dgsfediuxlxwolgiudftjdxvvemi/Build/Products/Debug-watchos/AppNameWatch.app: No such file or directory.

    I suspect this is related to how the iOS and watchOS targets are related to each other. Building for a physical iOS device fails every time.

  • I found the issue: for some reason, the watchOS target was missing from Target dependencies of the iOS target. Solved!

Add a Comment