3

我正在为我的一个应用程序编写一个手表应用程序。由于我的团队还没有 Apple Watch,我还在我的构建服务器上为我的 QA 团队构建了我的应用程序的模拟器版本,他们正在使用“xcrun simctl”来运行和测试手表应用程序本身。

在 Xcode 6.3 到来之前一切都很顺利。使用 Xcode 6.3,当我尝试在我的开发机器上本地构建应用程序时收到此错误:

error: The value of CFBundleVersion in your WatchKit app's Info.plist (1) does not match the value in your companion app's Info.plist (2.0.492). These values are required to match.

为了解决这个问题,我修改了我的info.plist文件以包含相同的CFBundleVersion. 此修改修复了我本地开发机器上的构建问题,但是:QA 仍然能够运行 iOS 应用程序,但启动 Watch 应用程序失败并出现以下错误:

> xcrun simctl launch 0D5238ED-CBE9-4DCC-961D-BC756E0885CD com.company.enterprise.appname.watchapp
An error was encountered processing the command (code=4):
The operation couldn’t be completed. (FBSOpenApplicationErrorDomain error 4.)

我在系统控制台日志中看不到任何可能与此相关的内容。:/

你知道如何解决这个问题吗?

提前感谢您的帮助!

4

3 回答 3

2

我也遇到了这个。

基本上,您应该有 3 个目标(如果计算测试,则为 4 个)。如果您检查构建阶段,您将看到必须首先编译 WatchKit 应用程序,然后是 WatchKit 扩展程序,最后是主应用程序。

我有一个使用了很长时间的脚本,每次编译应用程序时都会自动更新 CFBundleVersion。

在扩展和主应用程序的构建阶段中有一个“运行脚本”的地方,但不是 WatchKit 应用程序。

因此,首先编译的是 WatchKit 应用程序,然后将其移至构建目录。它将具有上次手动输入的 CFBundleVersion 中的任何数字。

运行的第二件事是扩展编译。这是我的脚本运行并更新数字的地方。然而,这个数字现在比 WatchKit 应用程序中的数字大一,该应用程序已被移动到构建目录。因此,即使他们以相同的数字(例如 1)开始生活,但当扩展名被移动时,它现在是 2,并且存在不匹配。

无法使用运行脚本以自动方式更新 WatchKit App CFBundleVersion。

就个人而言,我要解决它的方法是在我希望更改时在我的 WatchKit 应用程序中手动设置 CFBundleVersion,然后我将在其他两个目标的构建阶段运行脚本以复制 CFBundleVersion从 WatchKit App 到各自的 CFBundleVersions 以保持它们同步。

长话短说,您需要跟踪三个 CFBundleVersions 并确保它们的编号相同。

于 2015-04-17T21:08:35.373 回答
0

为了让 Watch 应用程序正常运行,某些属性必须在 Watch 应用程序及其应用程序扩展 (18857540) 中匹配:

  • WatchKit App Extension 的 Info.plist 中的WKAppBundleIdentifier属性NSExtensionAttributes必须与 WatchKit App 的 Info.plist 的 CFBundleIdentifier 匹配。
  • WKCompanionAppBundleIdentifierWatchKit App 的 Info.plist的属性必须与CFBundleIdentifierContaining iOS App 的 Info.plist 的属性相匹配。
于 2015-04-17T10:54:17.333 回答
0

我发现将 CFBundleGetInfoString 添加到 watchKit Extension/watchKitApp 给我带来了问题(可以将它放在配套的 iOS 应用程序本身中)。删除它为我解决了这个问题。

defaults delete `pwd`/myApp WatchKit Extension/Info CFBundleGetInfoString
defaults delete `pwd`/myApp WatchKit App/Info CFBundleGetInfoString
于 2015-04-19T10:07:22.870 回答