JamesDerrick248
JamesDerrick248

Reputation: 345

How to solve "Your target is built for tvOS but contains embedded content built for the watchOS (XXXX Watch App.app), which is not allowed"?

I would like to create a basic app (a list and a detail view for each row) using SwiftUI, and which would target iOS, macOS, tvOS and even watchOS.

I initially created a target allowing iOS, macOS and tvOS. Everything compiles fine.

Then, I tried adding a new target specific to watchOS, by doing so:

Targets > + > watchOS > App > then I chose "Watch App for existing iOS app", and finally created the target. And this is where I'm now getting this issue, when I try to compile both targets:

Your target is built for tvOS but contains embedded content built for the watchOS platform (My-iOS-Target Watch App.app), which is not allowed.

Could you explain what's wrong, and how can I solve this issue? Also, what are some good practices about this? (I'm experienced with iOS/macOS, but I don't know very well tvOS and watchOS).

Thanks for your help!

Upvotes: 3

Views: 263

Answers (1)

landonepps
landonepps

Reputation: 645

This can happen if the filter in the "Embed Watch Content" build phase is misconfigured.

Select your project in Xcode, then your tvOS target.
Go to Build Phases > Embed Watch Content.

You should see your watch app in the list.
Click on the button under Filters and make sure only "iOS" is selected.

Screenshot from Xcode demonstrating the above process

Upvotes: 2

Related Questions