使用Xcode上的App和Extension复制WatchOS2的目标 [英] Duplicating target for WatchOS2 with App and Extension on Xcode

查看:240
本文介绍了使用Xcode上的App和Extension复制WatchOS2的目标的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个带有WatchOS2目标和扩展的项目。我想复制WatchOS App目标和扩展。但是,当我复制WatchOS App目标时,它仍然链接到旧扩展。由于我们无法再访问WatchOS App的构建阶段,因此无法在嵌入式应用扩展阶段进行更改。

I have a project with a WatchOS2 target along with an Extension. I want to duplicate both the WatchOS App target and the extension. However, when I duplicate the WatchOS App target it is still linked to the old extension. Since we no longer have access to build phases for WatchOS App I cannot change it in the Embed App Extension Phase.


  • WatchAppTarget1(嵌入扩展 - WatchAppExtension1)

  • WatchAppExtension1


  • WatchAppTarget1(嵌入扩展 - WatchAppExtension1)

  • WatchAppExtension1

  • WatchAppTarget-Duplicate(嵌入式扩展程序仍然指向 - WatchAppExtension1)

  • WatchAppExtension-Duplicate

  • WatchAppTarget1 (Embed Extension - WatchAppExtension1)
  • WatchAppExtension1
  • WatchAppTarget-Duplicate (Embed Extension still pointing to - WatchAppExtension1)
  • WatchAppExtension-Duplicate

无论如何更改WatchOS App Target以接受重复的扩展作为其嵌入选择(除了手动编辑.pbxproj)

Is there anyway of changing the WatchOS App Target to accept the duplicated Extension as its choice to embed (other than manually editing the .pbxproj)

推荐答案

现在,我发现在浪费了大量时间之后实现这一目标的最不刺激的方法是将WatchOS应用程序更改为框架,以便Xcode提供构建阶段部分。

For now least irritating way I found to achieve this after wasting lots of hours is by changing the WatchOS app to behave like a framework so Xcode provides the Build phases section.

在文本编辑器中打开 project.pbxproj ,转到类似 / *开始PBXNativeTarget部分* / 的部分在配置中找到你的WatchOS目标(你想要更改的目标),它应该有一行:

Open the project.pbxproj in a text editor, go to the section which goes like/* Begin PBXNativeTarget section */ find your WatchOS target (the one you want to change) in the configuration, it should have a line :

productType =com.apple。 product-type.application.watchapp2;

将此更改为:

productType =com.apple.product-type.application; OR productType =com.apple.product-type.framework;

现在在Xcode中打开项目你应该是Apple看看Build Phases部分,去那里删除Target Dependencies中的旧扩展引用和嵌入应用程序扩展并将其替换为新的。完成后,返回 project.pbxproj 并撤消更改并将WatchOS目标恢复为 productType =com.apple.product- type.application.watchapp2;

Now open the project in Xcode you should be apple to see the Build Phases section, go there and remove the old extension references in "Target Dependencies" and "Embed App Extension" and replace it with the new ones. Once you are done go back to the project.pbxproj and undo your change and make the WatchOS target back to productType = "com.apple.product-type.application.watchapp2";

有时您可能需要为WatchOS和iOS应用程序制作新的构建方案,但是这个应该做的伎俩!

Sometimes you might have to make a fresh build scheme for both the WatchOS and the iOS app, but this should do the trick!

这篇关于使用Xcode上的App和Extension复制WatchOS2的目标的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆