gpt4 book ai didi

ios - WatchKit:bundle identifier 和 WKAppBundleIdentifer 有什么区别,为什么会导致 App groups 不能正常工作?

转载 作者:可可西里 更新时间:2023-11-01 01:06:06 25 4
gpt4 key购买 nike

我不知道 WKAppBundleIdentifier 的用途是什么。 WatchKit Extension 和 WKAppBundleIdentifer 的包标识符是否假设具有相同的 ID?当我为它们分配相同的 id com.myProbjectName.watchkitextension 时,在 iOS 模拟器和 iWatch 模拟器之间共享数据(应用程序组)根本不起作用。但是,如果我将 WKAppBundleIdentifer 更改为 com.myProbjectName.watchkitapp 并将 WatchKit 的包标识符保持不变 (com.myProbjectName.watchkitextension)在 iOS 模拟器和 Apple Watch 模拟器之间共享数据是可行的。为什么要这样做?WKAppBundleIdentifier 和包标识符 (CFBundleIdentifier) 有什么区别?

最佳答案

CFBundleIdentifier 是 WatchKit Extension 的 Bundle Identifier,其中包含 WatchKit App。因此,Bundle Identifier 对于扩展来说是唯一的,类似于 com.some.app.watchkitextension

WKAppBundleIdentifier 是捆绑在扩展中的 WatchKit 应用程序的标识符。这就是为什么这些值必须不同的原因,因为 WatchKit App 有自己的 Bundle Identifier(例如 com.some.app.watchkitapp)。这个值应该是 WatchKit App 的 CFBundleIdentifier 的值。

它也与供应有关。所有三个部分(iOS 应用程序、WatchKit 扩展和 WatchKit 应用程序)都必须有自己的 Bundle Identifier,因此配置文件。


WKAppBundleIdentifier 实际上是 NSExtension 下 WatchKit App 的 WatchKit 扩展规范的一部分。

<dict>
<key>NSExtensionAttributes</key>
<dict>
<key>WKAppBundleIdentifier</key>
<string>com.some.app.watchkitapp</string>
</dict>
<key>NSExtensionPointIdentifier</key>
<string>com.apple.watchkit</string>
</dict>

关于ios - WatchKit:bundle identifier 和 WKAppBundleIdentifer 有什么区别,为什么会导致 App groups 不能正常工作?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29688365/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com