我的项目或 Xcode 确实有些问题,两天以来我一直在努力弄清楚发生了什么。
我的应用程序运行得非常好,它是一个 OS X 应用程序,它包含一个 Today Widget 扩展。我最近完成了该项目,现在由于验证错误而无法发布该应用程序。
它始于验证器提示我的应用程序组,我用它在主应用程序和小部件扩展之间共享内容。该组被定义为 $(TeamIdentifierPrefix)com.acme.GreatApp
.
验证器提示我的组名格式错误,应该以我的 TEAMID 开头。绕圈跑了 3 个小时后,我更换了占位符 $(TeamIdentifierPrefix)
使用我的团队 ID(例如 S3F45A5S35.
)——这很有效。
然后验证器提示我的 info.plist
中的所有其他占位符。和权利文件,例如 $(PRODUCT_NAME)
, com.acme.GreatApp.$(PRODUCT_NAME:rfc1034identifier)
和 $(EXECUTABLE_NAME)
.我用它们对应的值替换了所有这些占位符,然后被接受了。
然后,有一段时间验证者提示结构性问题,这对我来说没有太大意义:
iTunes Store operation failed. Bad CFBundleExecutable. Cannot find executable file that matches the value of CFBundleExecutable in the nested bundle GreatAppWidget [com.acme.GreatApp.pkg/Payload/GreatApp.app/Contents] property list file
iTunes Store operation failed. Bad bundle identifier. The bundle identifier 'com.acme.GreatApp.GreatAppWidget' of the application extension GreatApp.app/Contents/Plugins/GreatAppWidget.appex should extend the dotted path of the bundle identifier of its containing application (com.acme.GreatApp.GreatAppWidget)
你是在告诉我我的扩展包含在我的扩展中吗?
iTunes Store operation failed. Invalid bundle location. Bundle GreatApp.app/Contents/Plugins/GreatAppWidget.appex must be contained in parent bundle's Contents/Plugins directory.
好吧,错误表明我应该做它声称不正确的事情。显然它在父应用程序文件夹中
Contents/Plugins
.所以呢?iTunes Store operation failed. The CFBundleExecutable of two bundles may not point to the same file. The following shared bundle path have been found: GreatApp.app/Contents.
问题是,我的应用程序和扩展程序运行良好。如果有任何东西被破坏,比如依赖关系、路径或其他什么,那么很可能是行不通的,不是吗?
此外,我没有修改任何build设置或任何我不理解的东西。这些都是默认设置。我创建了一个新的 Cocoa 应用程序,添加了一个新的 Today Widget Extension 作为目标——就是这样。我没有弄乱任何路径、位置、依赖关系等任何东西。
无论如何,这些错误只在一段时间内可见,我很幸运当时我做了一个截图。因为现在,它再次在错误消息中显示原始占位符,即使我没有更改可能导致这种情况的事情。我能记得我做的唯一一件事就是在磁盘、钥匙串(keychain)和成员(member)中心本地删除/撤销所有配置文件和证书,并通过 Xcode 从头开始创建所有内容。
现在错误如下所示:
iTunes Store operation failed. Bad CFBundleExecutable. Cannot find executable file that matches the value of CFBundleExecutable in the nested bundle ${bundleName} [${bundlePath}] property list file
iTunes Store operation failed. Bad bundle identifier. The bundle identifier '${bundleIdentifier}' of the application extension ${bundlePath} should extend the dotted path of the bundle identifier of its containing application (${parentBundleIdentifier})
iTunes Store operation failed. Invalid bundle location. Bundle ${bundlePath} must be contained in parent bundle's ${pluginsSubPath} directory.
iTunes Store operation failed. The CFBundleExecutable of two bundles may not point to the same file. The following shared bundle path have been found: ${sharedBundlePath}.
所以我想也许苹果只是在最近的更新中把它搞砸了,你只是无法验证带有扩展名的应用程序。所以我在网上搜索了一个非常好的例子Today-Scripts .我将应用程序组(
$(TeamIdentifierPrefix)com.acme.Today-Scripts
,这里的占位符完美地工作)添加到所有目标,激活沙盒,更改证书和配置文件:它完美地验证了!所以我比较了所有的build设置等。除了我必须用它们的实际值替换占位符,显然是证书和配置文件,以及在 Today-Scripts 中有一个嵌入到小部件中的额外 XPC 目标的事实,他们在原子上是相同的。每一个设置都是一样的。
我清除了所有缓存,真的很难。清理项目,清理
~/Library/Developer/Xcode/DerivedData
以及 ~/Library/Caches/com.apple.dt.Xcode
,重新启动几次,没有任何帮助。我真的很绝望,因为我不知道我能做什么。请有人解释一下 Xcode 在这里做什么以及为什么。
info.plist
中的所有占位符和权利文件? bundle
上面的错误发生在我工作时最佳答案
我终于找到了罪魁祸首!问题是,出于某种我无法解释的原因,info.plist
扩展的成员是主应用程序的成员(目标成员)。我刚刚发现通过逐个文件分析创建的存档文件并发现了一个额外的info.plist
里面GreatApp.app/Contents/Resources
文件夹。在该文件中,占位符未解析。然后存档验证器使用了这个 info.plist
进行验证。
那个小复选框花了我 3 天的时间。
关于Xcode - 由于解决 info.plist 和权利中的变量/占位符的奇怪问题而无法验证存档,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28710513/