0

I have a Xcode project with two targets for slightly different iOS apps. Both these apps also have a widget and an Apple Watch app so in total there are 8 targets in my project. I'll just call them Target1 and Target2 for now.

I was trying to run the Target2Watch app because I noticed some strange things. I could get it running at all and got a strange error message from Target1WatchExtension. I was confused because that's not the correct extension for the watch app so I searched a bit further.

I noticed that the schemes for Target1 are all correct but for Target2 and Target2Watch there were some strange configurations. Here are screenshots of the schemes:

enter image description here enter image description here

A colleague made the targets and I know that he duplicated Target1 to create Target2. My guess is something went wrong there.

What I cannot figure out is how to change the WatchExtension for Target2 because when I select it the minus button is disabled. Target2Watch has the same problem with the wrong WatchExtension so I need to change that as well.

How can I edit WatchExtensions for a scheme or is the scheme correct but are the target settings the problem?

PS. I'm using Xcode 7.3 and watchOS 2.0

Tom Spee
  • 9,209
  • 5
  • 31
  • 49

1 Answers1

0

For anyone who has the same problem: I've solved my problem thanks to this answer.

  1. Open project.pbxproj in a text editor (right click on YourProject.xcodeproj and choose Show Package Contents to find it)
  2. Find the line /* Begin PBXNativeTarget section */
  3. Go to the target with the wrong extension and change the line
    • productType = "com.apple.product-type.application.watchapp2";
    • to
    • productType = "com.apple.product-type.application";
  4. Open your project and select your target with the wrong extension
  5. Select Build Phases
  6. Remove wrong extensions in Target Dependencies and Embed App Extension and add correct extensions
  7. Go back to your project.pbxproj file in the text editor and change the productType of the target back to "com.apple.product-type.application.watchapp2";
  8. Et voila everything should be fine now
Community
  • 1
  • 1
Tom Spee
  • 9,209
  • 5
  • 31
  • 49