Duplicating target for WatchOS2 with App and Extension on Xcode

£可爱£侵袭症+ 提交于 2019-12-03 17:24:12
insanoid

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.

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";

Change this to:

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

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";

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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!