gpt4 book ai didi

ios - 在所有目标中使用相同的 CFBundleVersion 和 CFBundleShortVersionString

转载 作者:技术小花猫 更新时间:2023-10-29 10:42:41 25 4
gpt4 key购买 nike

我在提交应用程序更新时收到了来自 Apple 的以下电子邮件:

We have discovered one or more issues with your recent delivery for "Project". Your delivery was successful, but you may wish to correct the following issues in your next delivery:

CFBundleVersion Mismatch - The CFBundleVersion value '1' of extension 'Project.app/PlugIns/ProjectTodayExtension.appex' does not match the CFBundleVersion value '985' of its containing iOS application 'Project.app'.

CFBundleShortVersionString Mismatch - The CFBundleShortVersionString value '1.0' of extension 'Project.app/PlugIns/ProjectTodayExtension.appex' does not match the CFBundleShortVersionString value '2.1.6' of its containing iOS application 'Project.app'.

After you’ve corrected the issues, you can use Xcode or Application Loader to upload a new binary to iTunes Connect.

有没有办法在所有目标中使用相同的 CFBundleVersionCFBundleShortVersionString 来防止这种情况?

最佳答案

我的解决方案是:

对于CFBundleShortVersionString:

  • 在您的项目设置中添加用户定义的常量

Add a user-defined constant in your **project** settings

  • 将其命名为 $(CF_BUNDLE_SHORT_VERSION_STRING) 并将其设置为您想要的值

enter image description here

  • 将目标中的版本设置为 $(CF_BUNDLE_SHORT_VERSION_STRING)

enter image description here

  • 对所有目标重复。 完成!

CFBundleVersion:您可以对 CFBundleVersion 执行相同的操作,但不知何故我希望根据我的 GIT 存储库提交计数计算该值。我是这样做的:

  • 为您的主要目标添加一个预先行动。您可以通过 Product > Scheme > Edit Scheme
  • 访问显示的对话框

enter image description here

  • 为您的主要目标添加一个后处理。

enter image description here

  • 添加一个名为 BundleVersionUpdate 的新命令行工具目标和一个名为 BundleVersionRevert
  • 的目标

enter image description here

  • 导航到新的 BundleVersionUpdate 目标并添加新的运行脚本构建阶段

enter image description here

  • 粘贴以下内容
\#!/bin/sh

INFOPLIST="${SRCROOT}/MyApp/MyApp-Info.plist"
INFOPLIST_WKAPP="${SRCROOT}/MyApp-WKApp/Info.plist"
INFOPLIST_WKEXT="${SRCROOT}/MyApp-WKExt/Info.plist"

PLISTCMD="Set :CFBundleVersion $(git rev-list --all|wc -l)"

echo -n "$INFOPLIST"
| xargs -0 /usr/libexec/PlistBuddy -c "$PLISTCMD"

echo -n "$INFOPLIST_WKAPP"
| xargs -0 /usr/libexec/PlistBuddy -c "$PLISTCMD"

echo -n "$INFOPLIST_WKEXT"
| xargs -0 /usr/libexec/PlistBuddy -c "$PLISTCMD"
  • 导航到新的 BundleVersionRevert 目标并添加新的运行脚本构建阶段并粘贴:
\#!/bin/sh

INFOPLIST="${SRCROOT}/MyApp/MyApp-Info.plist"
INFOPLIST_WKAPP="${SRCROOT}/MyApp-WKApp/Info.plist"
INFOPLIST_WKEXT="${SRCROOT}/MyApp-WKExt/Info.plist"

PLISTCMD="Set :CFBundleVersion SCRIPTED"

echo -n "$INFOPLIST"
| xargs -0 /usr/libexec/PlistBuddy -c "$PLISTCMD"

echo -n "$INFOPLIST_WKAPP"
| xargs -0 /usr/libexec/PlistBuddy -c "$PLISTCMD"

echo -n "$INFOPLIST_WKEXT"
| xargs -0 /usr/libexec/PlistBuddy -c "$PLISTCMD"
  • 尽情享受吧!

关于ios - 在所有目标中使用相同的 CFBundleVersion 和 CFBundleShortVersionString,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30441750/

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