CFBundleVersion must be a period separated list of

2019-01-22 08:45发布

问题:

I'm getting this warning when trying to submit my app:

WARNING ITMS-9000: "This bundle is invalid. The value for key CFBundleVersion [3.3.9.2014.08.20] int the info.plist file must be a period separated list of at most three non-negative integers."

This is the first time I'm seeing this after a lot of submissions with that versioning format.

Is something changed regarding CFBundleVersion ?

I'm guessing the three wasn't always there? or apple just started warning us about it?

From the Apple docs:

CFBundleVersion

CFBundleVersion (String - iOS, OS X) specifies the build version number of the bundle, which identifies an iteration (released or unreleased) of the bundle. The build version number should be a string comprised of three non-negative, period-separated integers with the first integer being greater than zero. The string should only contain numeric (0-9) and period (.) characters. Leading zeros are truncated from each integer and will be ignored (that is, 1.02.3 is equivalent to 1.2.3). This key is not localizable.

Edit:

Apparently CFBundleVersion was changed as you can see here. It's a shame that I need to search WayBackMachine for something like that while Apple's "Document Revision History" says nothing about it.

回答1:

This happened to a framework I was using from Cocoapods, here is how I fixed it:

You need to find non-standard CFBundleShortVersionString in info.plist file. I searched through all of them and found this in one of the repos:

  <key>CFBundleShortVersionString</key>
  <string>HEAD based on 1.0</string>

Changed it to this:

  <key>CFBundleShortVersionString</key>
  <string>1.0</string>

and it worked

This method, created by Cocoapods developers also works:

https://github.com/Jonge/Cocoapods-frameworks-version-number-fix



回答2:

It looks like Apple has taken this a step further and made this an error (not sure when this happened, but I'm using Xcode 6). Attempting to submit an application with a CFBundleShortVersionString with more than 2 decimal points will result in an archive's submission to iTunes Connect to fail now.

You now must have a CFBundleShortVersionString like 1.0, 4.5.2, etc. to successfully submit your applications. Could be a bit annoying, but I suppose it makes sense.



回答3:

The recommended best-practice is to now use separate values for CFBundleShortVersionString and CFBundleVersion

  • 3-component max for CFBundleShortVersionString (ex: 4.2.3)
  • A build number CFBundleVersion

The CFBundleShortVersionString is the version shown on the App Store. The CFBundleVersion will need to change for every build you upload.

Ex: if you upload a new version (4.2.3) for review on iTunesConnect and if it gets rejected. You will need to resubmit a new build for the same version number (CFBundleShortVersionString = 4.2.3) with a different CFBundleVersion value



回答4:

If you're using CocoaPods, add this script to Podfile to handle non-numeric bundle versions:

# fix for non numeric CocoaPods versions
# https://github.com/CocoaPods/CocoaPods/issues/4421#issuecomment-151804311
post_install do |installer|
  plist_buddy = "/usr/libexec/PlistBuddy"
  installer.pods_project.targets.each do |target|
    plist = "Pods/Target Support Files/#{target}/Info.plist"
    original_version = `#{plist_buddy} -c "Print CFBundleShortVersionString" "#{plist}"`.strip
    changed_version = original_version[/(\d+\.){1,2}(\d+)?/]
    unless original_version == changed_version
      puts "Fix version of Pod #{target}: #{original_version} => #{changed_version}"
      `#{plist_buddy} -c "Set CFBundleShortVersionString #{changed_version}" "Pods/Target Support Files/#{target}/Info.plist"`
    end
  end
end

Example output for ReactiveCocoa 4:

Installing ReactiveCocoa (4.0.4-alpha-1)
(...)
Fix version of Pod ReactiveCocoa: 4.0.4-alpha-1 => 4.0.4


回答5:

Apparently CFBundleVersion was changed as you can see here. It's a shame that I need to search WayBackMachine for something like that while Apple's "Document Revision History" says nothing about it.



回答6:

Follow the error, then search following the CFBundleVersion, in your case search: 3.3.9.2014.08.20 then change it to right version like 3.3.9 or 3.4.0,…(it must greater than the old version)



回答7:

I was getting the Same issue as-

Blockquote

ERROR ITMS-90058: "This bundle is invalid. The value for key CFBundleVersion [ms-08-23] in the Info.plist file must be a period-separated list of at most three non-negative integers."

Blockquote

There after I went and searched with every Third party framework Plist and in SAP libraries I found Bundle version as [ms-08-23] . I changed it to a format of three non-negative integer i.e 3.0.0 , I changed it in every Framework of SAP - IT Worked.