Skip to content

Commit 9c676a3

Browse files
committed
[TIMOB-16987] Fixed version number formatting for iTunes sync builds.
1 parent 98d8c7b commit 9c676a3

File tree

1 file changed

+16
-4
lines changed

1 file changed

+16
-4
lines changed

iphone/cli/commands/_build.js

+16-4
Original file line numberDiff line numberDiff line change
@@ -1820,12 +1820,24 @@ iOSBuilder.prototype.createInfoPlist = function createInfoPlist(next) {
18201820
plist.CFBundleIdentifier = this.tiapp.id;
18211821

18221822
if (this.target == 'device' && this.deviceId == 'itunes') {
1823-
// device builds require an additional token to ensure uniqueness so that iTunes will detect an updated app to sync
1824-
plist.CFBundleVersion = this.tiapp.version + '.' + (new Date).getTime();
1823+
// device builds require an additional token to ensure uniqueness so that iTunes will detect an updated app to sync.
1824+
// we drop the milliseconds from the current time so that we still have a unique identifier, but is less than 10
1825+
// characters so iTunes 11.2 doesn't get upset.
1826+
plist.CFBundleVersion = String(+new Date);
1827+
this.logger.debug(__('Building for iTunes sync which requires us to set the CFBundleVersion to a unique number to trigger iTunes to update your app'));
1828+
this.logger.debug(__('Setting Info.plist CFBundleVersion to current epoch time %s', plist.CFBundleVersion.cyan));
18251829
} else {
1826-
plist.CFBundleVersion = this.tiapp.version;
1830+
plist.CFBundleVersion = String(this.tiapp.version);
1831+
this.logger.debug(__('Setting Info.plist CFBundleVersion to %s', plist.CFBundleVersion.cyan));
1832+
}
1833+
1834+
try {
1835+
plist.CFBundleShortVersionString = appc.version.format(this.tiapp.version, 0, 3);
1836+
this.logger.debug(__('Setting Info.plist CFBundleShortVersionString to %s', plist.CFBundleShortVersionString.cyan));
1837+
} catch (ex) {
1838+
plist.CFBundleShortVersionString = this.tiapp.version;
1839+
this.logger.debug(__('Setting Info.plist CFBundleShortVersionString to %s', plist.CFBundleShortVersionString.cyan));
18271840
}
1828-
plist.CFBundleShortVersionString = appc.version.format(plist.CFBundleVersion, 0, 3);
18291841

18301842
Array.isArray(plist.CFBundleIconFiles) || (plist.CFBundleIconFiles = []);
18311843
['.png', '@2x.png', '-72.png', '-60.png', '-60@2x.png', '-76.png', '-76@2x.png', '-Small-50.png', '-72@2x.png', '-Small-50@2x.png', '-Small.png', '-Small@2x.png', '-Small-40.png', '-Small-40@2x.png'].forEach(function (name) {

0 commit comments

Comments
 (0)