是否可以将一个WatchKit应用程序与多个iOS应用程序捆绑在一起?

时间:2023-01-24 13:05:26

I have a suite of apps on the app-store and I want to add Apple Watch support. These apps share a lot of common code and they are built from a single project with multiple targets.

我在app-store上有一套应用程序,我想添加Apple Watch支持。这些应用程序共享许多常用代码,它们是从具有多个目标的单个项目构建的。

I'd like to have a single WatchKit App with just one unique bundle ID, that is included in the target of each iOS apps, such that it is bundled with all of them, but if you install more than one app in my suite you would only get the single WatchKit App on your watch.

我想拥有一个只有一个唯一软件包ID的WatchKit应用程序,它包含在每个iOS应用程序的目标中,以便与所有这些应用程序捆绑在一起,但如果您在我的套件中安装了多个应用程序,只会在你的手表上获得单个WatchKit应用程序。

Is this possible technically, and allowed?

这在技术上是否可行,并且允许?

2 个解决方案

#1


Unfortunately, a WatchKit app resides as an extension to one host app, making multiple apps having one common extension impossible, and thus making one WatchKit app on multiple apps impossible.

不幸的是,WatchKit应用程序作为一个主机应用程序的扩展,使多个应用程序无法使用一个通用扩展,因此无法在多个应用程序上创建一个WatchKit应用程序。

Aside from this point, as you stated that one bundleID might work, the bundleID must have the parent app's bundle ID for the app to run, therefore ruling out sharing bundle IDs since each app must have a different bundle ID.

除此之外,正如您所说的一个bundleID可能有效,bundleID必须具有父应用程序的捆绑ID才能运行应用程序,因此排除共享捆绑ID,因为每个应用程序必须具有不同的捆绑ID。

#2


I don't think it's possible, since every watch extension's bundle ID is based on your application's bundle, and two applications can't share the same bundle ID.

我不认为这是可能的,因为每个监视扩展的捆绑ID都基于您的应用程序捆绑,并且两个应用程序不能共享相同的捆绑ID。

The bundle IDs for both new targets are configured automatically, based on the bundle ID of your iOS app. The base IDs for all three bundles must match; if you change your iOS app’s bundle ID, you must update the other bundle IDs accordingly.

根据iOS应用的捆绑包ID自动配置两个新目标的捆绑包ID。所有三个包的基本ID必须匹配;如果更改iOS应用程序的软件包ID,则必须相应地更新其他软件包ID。

Also, the watch extension linked to an application is in fact contained in it. You can't make reference to an extension that don't reside inside your application's bundle.

此外,链接到应用程序的手表扩展实际上也包含在其中。您不能引用不在应用程序包中的扩展名。

Source: https://developer.apple.com/library/ios/documentation/General/Conceptual/WatchKitProgrammingGuide/ConfiguringYourXcodeProject.html

#1


Unfortunately, a WatchKit app resides as an extension to one host app, making multiple apps having one common extension impossible, and thus making one WatchKit app on multiple apps impossible.

不幸的是,WatchKit应用程序作为一个主机应用程序的扩展,使多个应用程序无法使用一个通用扩展,因此无法在多个应用程序上创建一个WatchKit应用程序。

Aside from this point, as you stated that one bundleID might work, the bundleID must have the parent app's bundle ID for the app to run, therefore ruling out sharing bundle IDs since each app must have a different bundle ID.

除此之外,正如您所说的一个bundleID可能有效,bundleID必须具有父应用程序的捆绑ID才能运行应用程序,因此排除共享捆绑ID,因为每个应用程序必须具有不同的捆绑ID。

#2


I don't think it's possible, since every watch extension's bundle ID is based on your application's bundle, and two applications can't share the same bundle ID.

我不认为这是可能的,因为每个监视扩展的捆绑ID都基于您的应用程序捆绑,并且两个应用程序不能共享相同的捆绑ID。

The bundle IDs for both new targets are configured automatically, based on the bundle ID of your iOS app. The base IDs for all three bundles must match; if you change your iOS app’s bundle ID, you must update the other bundle IDs accordingly.

根据iOS应用的捆绑包ID自动配置两个新目标的捆绑包ID。所有三个包的基本ID必须匹配;如果更改iOS应用程序的软件包ID,则必须相应地更新其他软件包ID。

Also, the watch extension linked to an application is in fact contained in it. You can't make reference to an extension that don't reside inside your application's bundle.

此外,链接到应用程序的手表扩展实际上也包含在其中。您不能引用不在应用程序包中的扩展名。

Source: https://developer.apple.com/library/ios/documentation/General/Conceptual/WatchKitProgrammingGuide/ConfiguringYourXcodeProject.html