CFBundleShortVersionString 必须是大多数三个非负整数的句点分隔列表
CFBundleShortVersionString must be a period-separated list of most three non-negative integers
将我的应用程序提交到应用程序商店时出现此错误:
这是我的 info.plist 文件中的相关部分:
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
<string>$(PRODUCT_NAME)</string>
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
<string>1.0.0</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string>1.0.0</string>
当我提交应用程序时,您可以清楚地看到没有版本1.0.0.pre
。
我也用 CocoaPods。
如何解决这个问题?
更新:这是我在我的项目路径上尝试的:find . -name "*.plist" -exec grep -o -A 1 "CFBundleShortVersionString" {} \;
,这是结果:
CFBundleShortVersionString
<string>1.0.6</string>
CFBundleShortVersionString
<string>1.0</string>
CFBundleShortVersionString
<string>3.3.4</string>
CFBundleShortVersionString
<string>1.5.5</string>
CFBundleShortVersionString
<string>2.0.2</string>
CFBundleShortVersionString
<string>0.7.0</string>
CFBundleShortVersionString
<string>0.0.9</string>
CFBundleShortVersionString
<string>1.2.2</string>
CFBundleShortVersionString
<string>1.6.0</string>
CFBundleShortVersionString
<string>1.7.2</string>
CFBundleShortVersionString
<string>2.0.0</string>
CFBundleShortVersionString
<string>1.3.2</string>
CFBundleShortVersionString
<string>1.4.1</string>
CFBundleShortVersionString
<string>1.0</string>
CFBundleShortVersionString
<string>0.9.1</string>
CFBundleShortVersionString
<string>0.2.3</string>
CFBundleShortVersionString
<string>1.0.0</string>
CFBundleShortVersionString
<string>3.7.3</string>
CFBundleShortVersionString
<string>0.15.0</string>
CFBundleShortVersionString
<string>1.0.0.pre</string>
CFBundleShortVersionString
<string>2.3.0</string>
CFBundleShortVersionString
<string>2.0.0</string>
CFBundleShortVersionString
<string>1.2</string>
CFBundleShortVersionString
<string>3.0.2</string>
更新 2:执行:xcodebuild > build.log
我收到以下错误:
2015-10-25 22:02:52.653 xcodebuild[6273:1043943] [MT] PluginLoading: Required plug-in compatibility UUID 7265231C-39B4-402C-89E1-16167C4CC990 for plug-in at path '~/Library/Application Support/Developer/Shared/Xcode/Plug-ins/VVDocumenter-Xcode.xcplugin' not present in DVTPlugInCompatibilityUUIDs
** BUILD FAILED **
检查 1:
您可能需要在构建设置中搜索 "version"。如果出现奇怪的情况,我通常使用 "view":
- 转到构建设置。
- 在 "Basic All" select "All"
的左侧
- 在 "Combined Level" select "Level"
的左侧
- 在搜索框中输入 "version" 然后按 return/enter
在我的 MacOSX 测试项目中它看起来像这样:
请注意,有一个名为 "version name suffix" 的条目。我不确定,这是否存在于 iOS 项目中(稍后会测试)。在任何情况下,您都可以查看 "easily" 与 "version" 相关的设置。
检查2:
或者您可以 grep 项目文件:
grep pre MyProject.xcodeproj/project.pbxproj
检查 3:
打开终端并在项目目录中调用:
xcodebuild clean
xcodebuild > build.log
椰子类可能是这样的:
xcodebuild -workspace PRJ.xcworkspace -scheme PRJ clean
xcodebuild -workspace PRJ.xcworkspace -scheme PRJ > build.log
在 build.log
中搜索 "ProcessInfoPlistFile"。在我的例子中,它看起来像这样:(手动包装 - 实际项目名称已更改)
ProcessInfoPlistFile build/Release-iphoneos/PRJ.app/Info.plist PRJ/Info.plist
cd /Users/fsc/prj/PRJ
export PATH="/Applications/Xcode.app/..."
builtin-infoPlistUtility /Users/fsc/prj/PRJ/PRJ/Info.plist
-genpkginfo /Users/fsc/prj/PRJ/build/Release-iphoneos/PRJ.app/PkgInfo
-expandbuildsettings -format binary -platform iphoneos
-additionalcontentfile /Users/fsc/prj/PRJ/build/PRJ.build/Release-iphoneos/PRJ.build/Main-SBPartialInfo.plist
-additionalcontentfile /Users/fsc/prj/PRJ/build/PRJ.build/Release-iphoneos/PRJ.build/LaunchScreen-PartialInfo.plist
-additionalcontentfile /Users/fsc/prj/PRJ/build/PRJ.build/Release-iphoneos/PRJ.build/assetcatalog_generated_info.plist
-o /Users/fsc/prj/PRJ/build/Release-iphoneos/PRJ.app/Info.plist
注意 -additionalcontentfile
。请检查列出了哪些附加文件并检查这些文件。
检查 4:
查看 IPA 存档以查看实际找到“1.0.0.pre”的位置。为此,请打开 "Window > Organizer"、select 您的应用并按 "Export..."。 Select "Save for iOS App Store Deployment"。结果将是一个 .ipa
文件。将它重命名为 PRJ.ipa.zip
- 然后你可以解压它。查找 .plist 文件并检查其内容。
您的第 3 方 pod 的版本号为“1.0.0.pre”。似乎错误与它有关。该错误没有说明是哪个 plist,也许您的构建不止一个。例如,有问题的 pod 自己创建了一个包。
查找版本号
由于您没有在项目中看到该字符串,因此很可能是与您的项目关联的包、框架或库负责。从项目的最顶层目录中,除了 grep
之外,您还可以使用 find
来查找罪魁祸首:
find . -name "*.plist" -exec grep -iq "CFBundleShortVersionString" {} \; \
-exec grep -Him 1 "1.0.0.pre" {} \;
这可能 return 结果类似于:
Binary file ./FooProject/Foo.framework/Info.plist matches
./FooProject/Resources/Info.plist- <string>1.0.0.pre</string>
如果事件结果是 returned,那么您将找到“ERROR ITMS-90096 This bundle is invalid. The value for key CFBundleVersionShortString...”。如果结果 returned 在框架内,如上面第一个结果(例如 Binary file
)或另一个 bundle/library 所示,那么您将需要更改其定义的项目中的值(提供这只是版本号中的一个错误)。您还可以创建一个清理脚本,以在代码签名之前的构建时替换该值。
1.0.0.pre
这里更重要的是您的应用被拒绝的原因以及 1.0.0.pre
版本的创建目的。使用故意让您的应用程序被拒绝的版本标签是为了防止您在生产应用程序中使用预发布代码 — 这是设计使然。创建特定 pod、bundle、框架、库的人告诉您:
"Don't use this prerelease code in an app that you are planning to deploy to the public".
我建议不要只是简单地更改项目的版本号 .plist
以便您的应用成功提交——而是检查用于生产的稳定发布版本。
多个Info.plists
框架、pods 和捆绑包都有自己的 .plist
和版本号。它们不是 "overriding" 您的主要应用程序版本号,而只是拥有自己的版本号(其中一个显然无效)。
这很可能是与 CocoaPods 相关的问题,请勿手动更改框架中的 info.plist
,请执行以下步骤:
1) 在 Podfile 的末尾添加此脚本。
post_install do |installer|
app_plist = "MyApp/Info.plist"
plist_buddy = "/usr/libexec/PlistBuddy"
version = `#{plist_buddy} -c "Print CFBundleShortVersionString" #{app_plist}`
version = `echo "#{version}" | tr -d '\n'`
puts "Updating CocoaPods frameworks' version numbers to #{version}"
installer.pods_project.targets.each do |target|
`#{plist_buddy} -c "Set CFBundleShortVersionString #{version}" "Pods/Target Support Files/#{target}/Info.plist"`
end
end
2) 更新 app_plist
变量中的路径,使其与您应用的 .plist 文件的路径匹配。
3) 运行 pod install
之后。
此脚本更改所有 Cocoapods 框架的版本号以匹配应用程序的 plist,这是 2015 年 10 月 21 日所必需的。
Pod 安装对我有用。你可以试一次。
将我的应用程序提交到应用程序商店时出现此错误:
这是我的 info.plist 文件中的相关部分:
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
<string>$(PRODUCT_NAME)</string>
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
<string>1.0.0</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string>1.0.0</string>
当我提交应用程序时,您可以清楚地看到没有版本1.0.0.pre
。
我也用 CocoaPods。
如何解决这个问题?
更新:这是我在我的项目路径上尝试的:find . -name "*.plist" -exec grep -o -A 1 "CFBundleShortVersionString" {} \;
,这是结果:
CFBundleShortVersionString
<string>1.0.6</string>
CFBundleShortVersionString
<string>1.0</string>
CFBundleShortVersionString
<string>3.3.4</string>
CFBundleShortVersionString
<string>1.5.5</string>
CFBundleShortVersionString
<string>2.0.2</string>
CFBundleShortVersionString
<string>0.7.0</string>
CFBundleShortVersionString
<string>0.0.9</string>
CFBundleShortVersionString
<string>1.2.2</string>
CFBundleShortVersionString
<string>1.6.0</string>
CFBundleShortVersionString
<string>1.7.2</string>
CFBundleShortVersionString
<string>2.0.0</string>
CFBundleShortVersionString
<string>1.3.2</string>
CFBundleShortVersionString
<string>1.4.1</string>
CFBundleShortVersionString
<string>1.0</string>
CFBundleShortVersionString
<string>0.9.1</string>
CFBundleShortVersionString
<string>0.2.3</string>
CFBundleShortVersionString
<string>1.0.0</string>
CFBundleShortVersionString
<string>3.7.3</string>
CFBundleShortVersionString
<string>0.15.0</string>
CFBundleShortVersionString
<string>1.0.0.pre</string>
CFBundleShortVersionString
<string>2.3.0</string>
CFBundleShortVersionString
<string>2.0.0</string>
CFBundleShortVersionString
<string>1.2</string>
CFBundleShortVersionString
<string>3.0.2</string>
更新 2:执行:xcodebuild > build.log
我收到以下错误:
2015-10-25 22:02:52.653 xcodebuild[6273:1043943] [MT] PluginLoading: Required plug-in compatibility UUID 7265231C-39B4-402C-89E1-16167C4CC990 for plug-in at path '~/Library/Application Support/Developer/Shared/Xcode/Plug-ins/VVDocumenter-Xcode.xcplugin' not present in DVTPlugInCompatibilityUUIDs
** BUILD FAILED **
检查 1:
您可能需要在构建设置中搜索 "version"。如果出现奇怪的情况,我通常使用 "view":
- 转到构建设置。
- 在 "Basic All" select "All" 的左侧
- 在 "Combined Level" select "Level" 的左侧
- 在搜索框中输入 "version" 然后按 return/enter
在我的 MacOSX 测试项目中它看起来像这样:
请注意,有一个名为 "version name suffix" 的条目。我不确定,这是否存在于 iOS 项目中(稍后会测试)。在任何情况下,您都可以查看 "easily" 与 "version" 相关的设置。
检查2:
或者您可以 grep 项目文件:
grep pre MyProject.xcodeproj/project.pbxproj
检查 3:
打开终端并在项目目录中调用:
xcodebuild clean
xcodebuild > build.log
椰子类可能是这样的:
xcodebuild -workspace PRJ.xcworkspace -scheme PRJ clean
xcodebuild -workspace PRJ.xcworkspace -scheme PRJ > build.log
在 build.log
中搜索 "ProcessInfoPlistFile"。在我的例子中,它看起来像这样:(手动包装 - 实际项目名称已更改)
ProcessInfoPlistFile build/Release-iphoneos/PRJ.app/Info.plist PRJ/Info.plist
cd /Users/fsc/prj/PRJ
export PATH="/Applications/Xcode.app/..."
builtin-infoPlistUtility /Users/fsc/prj/PRJ/PRJ/Info.plist
-genpkginfo /Users/fsc/prj/PRJ/build/Release-iphoneos/PRJ.app/PkgInfo
-expandbuildsettings -format binary -platform iphoneos
-additionalcontentfile /Users/fsc/prj/PRJ/build/PRJ.build/Release-iphoneos/PRJ.build/Main-SBPartialInfo.plist
-additionalcontentfile /Users/fsc/prj/PRJ/build/PRJ.build/Release-iphoneos/PRJ.build/LaunchScreen-PartialInfo.plist
-additionalcontentfile /Users/fsc/prj/PRJ/build/PRJ.build/Release-iphoneos/PRJ.build/assetcatalog_generated_info.plist
-o /Users/fsc/prj/PRJ/build/Release-iphoneos/PRJ.app/Info.plist
注意 -additionalcontentfile
。请检查列出了哪些附加文件并检查这些文件。
检查 4:
查看 IPA 存档以查看实际找到“1.0.0.pre”的位置。为此,请打开 "Window > Organizer"、select 您的应用并按 "Export..."。 Select "Save for iOS App Store Deployment"。结果将是一个 .ipa
文件。将它重命名为 PRJ.ipa.zip
- 然后你可以解压它。查找 .plist 文件并检查其内容。
您的第 3 方 pod 的版本号为“1.0.0.pre”。似乎错误与它有关。该错误没有说明是哪个 plist,也许您的构建不止一个。例如,有问题的 pod 自己创建了一个包。
查找版本号
由于您没有在项目中看到该字符串,因此很可能是与您的项目关联的包、框架或库负责。从项目的最顶层目录中,除了 grep
之外,您还可以使用 find
来查找罪魁祸首:
find . -name "*.plist" -exec grep -iq "CFBundleShortVersionString" {} \; \
-exec grep -Him 1 "1.0.0.pre" {} \;
这可能 return 结果类似于:
Binary file ./FooProject/Foo.framework/Info.plist matches
./FooProject/Resources/Info.plist- <string>1.0.0.pre</string>
如果事件结果是 returned,那么您将找到“ERROR ITMS-90096 This bundle is invalid. The value for key CFBundleVersionShortString...”。如果结果 returned 在框架内,如上面第一个结果(例如 Binary file
)或另一个 bundle/library 所示,那么您将需要更改其定义的项目中的值(提供这只是版本号中的一个错误)。您还可以创建一个清理脚本,以在代码签名之前的构建时替换该值。
1.0.0.pre
这里更重要的是您的应用被拒绝的原因以及 1.0.0.pre
版本的创建目的。使用故意让您的应用程序被拒绝的版本标签是为了防止您在生产应用程序中使用预发布代码 — 这是设计使然。创建特定 pod、bundle、框架、库的人告诉您:
"Don't use this prerelease code in an app that you are planning to deploy to the public".
我建议不要只是简单地更改项目的版本号 .plist
以便您的应用成功提交——而是检查用于生产的稳定发布版本。
多个Info.plists
框架、pods 和捆绑包都有自己的 .plist
和版本号。它们不是 "overriding" 您的主要应用程序版本号,而只是拥有自己的版本号(其中一个显然无效)。
这很可能是与 CocoaPods 相关的问题,请勿手动更改框架中的 info.plist
,请执行以下步骤:
1) 在 Podfile 的末尾添加此脚本。
post_install do |installer|
app_plist = "MyApp/Info.plist"
plist_buddy = "/usr/libexec/PlistBuddy"
version = `#{plist_buddy} -c "Print CFBundleShortVersionString" #{app_plist}`
version = `echo "#{version}" | tr -d '\n'`
puts "Updating CocoaPods frameworks' version numbers to #{version}"
installer.pods_project.targets.each do |target|
`#{plist_buddy} -c "Set CFBundleShortVersionString #{version}" "Pods/Target Support Files/#{target}/Info.plist"`
end
end
2) 更新 app_plist
变量中的路径,使其与您应用的 .plist 文件的路径匹配。
3) 运行 pod install
之后。
此脚本更改所有 Cocoapods 框架的版本号以匹配应用程序的 plist,这是 2015 年 10 月 21 日所必需的。
Pod 安装对我有用。你可以试一次。