Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

iOS build number in Cordova app

Tags:

xcode

ios

cordova

Using Cordova 3.5.0, when I run cordova prepare ios it overwrites my build number as well as the app's version number, using the version string from config.xml.

From:

<widget id="tld.domain.app" version="1.0.1"   

It sets the CFBundleVersion the same as the short version:

enter image description here

So I have to keep manually keep resetting my build number to my format which is YYYYMMDD.

Ideally I'd like it to either leave the build number alone, or be able to set it explicitly in the config.xml file.

Are either of these possible?

like image 596
Ade Avatar asked Jun 09 '14 08:06

Ade


People also ask

What is iOS build number?

To see your macOS version and build numbers on a Mac, choose Apple > About This Mac and click the version number. In iOS or iPadOS, go to Settings > General > About and tap Software Version. For watchOS, in your iPhone's Watch app, go to General > About and look at the Version line.

Does Cordova work for iOS?

Cordova for iOS projects can be opened in Xcode. This can be useful if you wish to use Xcode built in debugging/profiling tools or if you are developing iOS plugins. Please note that when opening your project in Xcode, it is recommended that you do NOT edit your code in the IDE.

How do I change my number on iOS build?

Click the Xcode Cloud tab and choose Settings in the sidebar. Click the Build Number tab below Settings. Click the Edit button next to Next Build Number. Enter a new build number and save your changes.


2 Answers

I found the answer in this resolved issue.

There are separate versionCode attributes (separate to version) for iOS and Android, that need to be added to your config.xml file:

<widget ... android-versionCode="201406092" ios-CFBundleVersion="201406092" 
like image 164
Ade Avatar answered Sep 27 '22 19:09

Ade


This post here was a little clearer to me, a little more complete, so I mention it just in case it helps. Note that, effectively, it is almost the exact same as what Ade said. I only provide it because the first time I read Ade's answer, I was confused and did not fully understand his answer until I saw the answer below.

If you want to separate the build number from the version number, you can add the following attributes to the widget tag in your config.xml:

version="VERSIONNR" android-versionCode="BUILDNR" ios-CFBundleVersion="BUILDNR" 

so the complete tag, with those attributes included, looks something like this:

<widget id="APPID" version="VERSIONNR" android-versionCode="BUILDNR"  ios-CFBundleVersion="BUILDNR" xmlns="http://www.w3.org/ns/widgets" xmlns:cdv="http://cordova.apache.org/ns/1.0"> 

(text in uppercase are placeholders)

like image 26
Tony B Avatar answered Sep 27 '22 19:09

Tony B