CFBundleShortVersionString must be a period-separated list of most three non-negative integers

流过昼夜 提交于 2019-12-10 14:58:19

问题


When submitting my app to the app store I get this error:

Here is the relevant part from my info.plist file:

    <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>

When I submit the app you can clearly see that there is no version 1.0.0.pre.

I use CocoaPods as well.

How do I solve this problem?

Update: Here is what I try on my project path: find . -name "*.plist" -exec grep -o -A 1 "CFBundleShortVersionString" {} \; and here is the result:

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>

Update 2: Doing: xcodebuild > build.log I get the following error:

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:


Check 1:

You may want to search for "version" in the build settings. In case of weird situations I usually use this "view":

  1. Go to the Build Settings.
  2. On the left hand side from "Basic All" select "All"
  3. On the left hand side from "Combined Level" select "Level"
  4. In the search box type "version" and press return/enter

In my MacOSX test project it looks like this:

Note that there is an entry named "version name suffix". I'm not sure, whether or not this exists in an iOS project (will test later). In any case you can look through the settings which "easily" relate to "version".

Check 2:

Alternatively you could grep the project file:

grep pre MyProject.xcodeproj/project.pbxproj

Check 3:

Open a terminal and in the project directory call this:

xcodebuild clean
xcodebuild > build.log

with cocoapods likely this:

xcodebuild -workspace PRJ.xcworkspace -scheme PRJ clean
xcodebuild -workspace PRJ.xcworkspace -scheme PRJ > build.log

In build.log search for "ProcessInfoPlistFile". In my case it looks like this: (manually wrapped - actual project name changed)

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

Note the -additionalcontentfile. Please check which additional files are listed and check these.

Check 4:

Look into the IPA archive to see where the "1.0.0.pre" actually is found. For that open "Window > Organizer", select your app and press "Export...". Select "Save for iOS App Store Deployment". The result will be an .ipa file. Rename it to PRJ.ipa.zip - then you can unpack it. Look for the .plist files and check their content.




回答2:


Locating Version Numbers

Since you don't see the string within your project it's likely there is a bundle, frameworks or libraries associated with your project that is responsible. From the topmost directory in your project you can use find in addition to grep to look for the culprit:

find . -name "*.plist" -exec grep -iq "CFBundleShortVersionString" {} \; \
-exec grep -Him 1 "1.0.0.pre" {} \;

This may return results that might resemble something such as:

Binary file ./FooProject/Foo.framework/Info.plist matches
./FooProject/Resources/Info.plist-  <string>1.0.0.pre</string>

In the event results are returned then you'll have located the reason for the "ERROR ITMS-90096 This bundle is invalid. The value for key CFBundleVersionShortString...". If the result returned is within a Framework as shown in the first result above (eg. Binary file) or another bundle/library then you will need to change the value within it's defined project (provided that it's simply a mistake in the version number). You could also create a clean up script to replace the value at build time before code signing.

1.0.0.pre

The more important thing here though is why your app was rejected and what the 1.0.0.pre version was created specifically to do. Using a version tag that purposefully makes your app get rejected was meant to prevent you from using prerelease code in a production app — it's by design. The person(s) who created that specific pod, bundle, framework, library, are telling you:

"Don't use this prerelease code in an app that you are planning to deploy to the public".

I would suggest not just simply changing the version number of the items .plist so that your app submits successfully — instead check for a stable release version meant for production.

Multiple Info.plists

Frameworks, pods, and bundles all have their own .plist and version numbers. They are not "overriding" your main applications version number but rather simply have their own (one of which obviously not valid).




回答3:


One of your 3rd party pod has the version number "1.0.0.pre". Seems the error relates to it. The error doesnt say which plist, perhaps your build has more than one. Eg the pod in question creates a bundle on its own for instance.




回答4:


It is most likely a CocoaPods related problem, do not change the info.plist's in your frameworks manually, do these steps:

1) Add this script at the end of your 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) Update the path in app_plist variable so that it matches the path to your app's .plist file.

3) Run pod install afterwards.

This script changes all Cocoapods frameworks' version numbers to match the app's plist, which is required as of 21 Oct 2015.



来源:https://stackoverflow.com/questions/33287059/cfbundleshortversionstring-must-be-a-period-separated-list-of-most-three-non-neg

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!