How to specify Build Number in iOS build?

Getting into LiveCode for iOS? Ask your questions here.

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Post Reply
paulsr
Posts: 222
Joined: Thu Jul 19, 2012 9:47 am
Location: Khanom, Nakhon Si Thammarat, Thailand
Contact:

How to specify Build Number in iOS build?

Post by paulsr » Wed Feb 01, 2017 11:51 am

Greetings:

I have built a new version (2.1.3) of an app and submitted it to iTunesConnect. When I select the uploaded binary and click Submit for Review, I get an error:

"The app's Info.plist can't contain values for the UIRequiredDeviceCapabilities key that would prevent this app from
opening on any iOS device that was supported by previous versions."

So, I think I know what's causing that, I've made changes, and built a new binary.

*** But - here's the problem ***

I can't find any way to upload the new binary.

There seems to be no way to delete a submitted binary, and Apple won't accept a new binary with the same version number.

It won't let me create a new version - say 2.1.4.

From what I've read online, I can submit with the same version number and a new build number. But how, in Livecode, can I set a build number???

The version and build numbers seem to be the same. In iTunes connect the current build shows as 2.1.3(2.1.3) - the second nbr I assume is the build nbr.

I've looked in Info.plist and can see both numbers - but if I change one, Apple won't accept the binary.

I'm stuck!

Can someone please tell me how to specify a build number, or suggest some other solution to this dilemma.

Many thanks,

--paul

LiveCode_Panos
Livecode Staff Member
Livecode Staff Member
Posts: 818
Joined: Fri Feb 06, 2015 4:03 pm

Re: How to specify Build Number in iOS build?

Post by LiveCode_Panos » Wed Feb 01, 2017 2:01 pm

Hi Paul,

I think I know where is the problem. It is not related to the "version number". Apple's submission policy is to reject a new binary if it prevents the application from running on devices that were supported by previous versions.

By marking for example "location services" and "gps" as "required" in the Standalone Application Settings for iOS, you restrict the app to devices that support gps and location services.

There was a bug in older versions of LiveCode, where setting "Requirements and Permissions" in the Standalone Application Settings for iOS was not taken into account, so all of them were considered as n/a (of course this did not prevent for example GPS and location services to work as expected in devices that supported this functionality).

So what happens in your case is:

1. You had already uploaded a version of the app using an older version of LiveCode
2. You had set for example GPS and Location Services as 'required', but actually they were marked as 'n/a'
3. You now try to upload a new binary of the same app (built with a newer version of LiveCode)
4. You have exactly the same settings (i.e. GPS and Location Services as 'required'), and this time these settings are actually taken into account. So the app's Info.plist now contains some values for the UIRequiredDeviceCapabilities key, which were not contained in previous version
5. The number of supported devices is now smaller, so Apple rejects the binary.

You can do one of the following to solve this problem:

1. Submit a brand new app, with a different app id, and mark GPS and location services as 'required'. (Not a very good solution IMO, unless you don't care losing reviews etc)

2. Re-submit the current app, but first make sure you have marked "GPS" and "Location services" (or any other permission) as 'n/a'. Note that this will not prevent your app from working as expected in devices that support GPS and Location Services.

Hope this helps.

Panos

paulsr
Posts: 222
Joined: Thu Jul 19, 2012 9:47 am
Location: Khanom, Nakhon Si Thammarat, Thailand
Contact:

Re: How to specify Build Number in iOS build?

Post by paulsr » Thu Feb 02, 2017 8:12 am

Many thanks Panos for your comprehensive reply. Your assessment of the situation is 100% correct.

But...
LiveCode_Panos wrote:Hi Paul,

You can do one of the following to solve this problem:

1. Submit a brand new app, with a different app id, and mark GPS and location services as 'required'. (Not a very good solution IMO, unless you don't care losing reviews etc)

2. Re-submit the current app, but first make sure you have marked "GPS" and "Location services" (or any other permission) as 'n/a'. Note that this will not prevent your app from working as expected in devices that support GPS and Location Services.

Panos
I cannot do #1. I need a way to provide free upgrades to existing purchasers.

I cannot do #2 either. Apple will not accept a second binary with the same Version and Build numbers. I can't delete the one that's already there (used to be possible) and I can't find a way to change the build number.

I've read on non-LC forums that the solution is to change the build nbr., but it seems LC automatically sets it to be the same as the version nbr.

So now I'm stuck!

Any ideas?

TIA

--paul

PS I should have mentioned my environment is LC8.1.2 on OSX 10.11.6, Xcode 8.1 and App Loader 3.0

LiveCode_Panos
Livecode Staff Member
Livecode Staff Member
Posts: 818
Joined: Fri Feb 06, 2015 4:03 pm

Re: How to specify Build Number in iOS build?

Post by LiveCode_Panos » Thu Feb 02, 2017 11:58 am

Ok I see the new problem now. Now in iTunes Connect, if a binary is rejected, an attempt to re-upload a binary via the application loader (with same version number) will result in

“Redundant Binary Upload. There already exists a binary upload with build version..."

This is because there should be 2 *different* key-value pairs in the info.plist file of the app, one that indicates the “Version Number”, named “CFBundleShortVersionString”, with value e.g. 2.1.3, and one that indicates the “Build Number”, named "CFBundleVersion", with value e.g. 2.1.3.1. It is recommended that the build number has the format <version_number>.<X>, where X=1,2,3..

Currently, the LC standalone builder for iOS fills the value of those 2 keys in the plist with *the same* number, in this case the “version number” in the standalone settings. Indeed, if you have a look at the template plist file that is used it has the following lines:

Code: Select all

<key>CFBundleVersion</key>
<string>${BUNDLE_VERSION}</string>
<key>CFBundleShortVersionString</key>
<string>${BUNDLE_VERSION}</string>
The ${BUNDLE_VERSION} *in both cases* is replaced by the the “version number” in the standalone settings. So currently there is no way to set the “build number” from the Standalone settings.

However, you can use the following workaround:

1. Navigate to LC 8.1.2 Application Folder / Contents / Tools / Runtime / iOS / Device-10_1
2. Copy the Settings.plist file, and paste it to your Desktop
3. Open Desktop / Settings.plist with e.g. TextWrangler editor (The file should be read-only. Make sure you add write permissions first)
4. Find the following key-value pair:

Code: Select all

<key>CFBundleVersion</key>
        <string>${BUNDLE_VERSION}</string>
and change it as follows:

Code: Select all

<key>CFBundleVersion</key>
        <string>2.1.3.1</string>
5. Do NOT modify the following key-value pair:

Code: Select all

<key>CFBundleShortVersionString</key>
	<string>${BUNDLE_VERSION}</string>
since this will be updated when you save as a standalone. It will be populated with the value of the “Version” field in the Standalone Application Settings for iOS.

5. Save the Settings.plist file.
6. Rename this file (Settings.plist) to Info.plist
7. LC > Myapp > Standalone App Settings - add the desktop Info.plist file into the Copy Files
8. LC > Myapp > Build Standalone Application

9. You can verify that your plist has now 2 different values for those 2 keys by opening the MyApp/MyApp.app/Contents/Info.plist with a text editor and see that:

Code: Select all

<key>CFBundleVersion</key>
<string>2.1.3.1</string>
<key>CFBundleShortVersionString</key>
<string>2.1.3</string>

Best,
Panos
--

PS: Another workaround is to Edit the original Settings.plist file in the LiveCode app bundle:

1. Open a terminal
2. Type:
sudo nano path/to/LC Application Folder/Contents/Tools/Runtime/iOS/Device-10_1/Settings.plist

3. Find

Code: Select all

<key>CFBundleVersion</key>
        <string>${BUNDLE_VERSION}</string>
and replace it with

Code: Select all

<key>CFBundleVersion</key>
        <string>2.1.3.1</string>
4. Press Ctrl + O, then Enter and then Ctrl + X to exit

5. Your changes should now be saved. You don't need to add anything in the Copy Files section

dave.kilroy
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 858
Joined: Wed Jun 24, 2009 1:17 pm
Location: Plymouth, UK
Contact:

Re: How to specify Build Number in iOS build?

Post by dave.kilroy » Thu Feb 02, 2017 12:48 pm

Thanks for this Panos!

One day I swear I'll find the time to fork the code for the Standalone Builder and see if I can find where it builds the .plist file - and see if I can add a box to the Standalone Builder gui and hook them up...
"...this is not the code you are looking for..."

paulsr
Posts: 222
Joined: Thu Jul 19, 2012 9:47 am
Location: Khanom, Nakhon Si Thammarat, Thailand
Contact:

Re: How to specify Build Number in iOS build?

Post by paulsr » Fri Feb 03, 2017 3:20 am

Genius! Thanks so much for this Panos. Worked like a charm.

Hopefully this will help someone else in the future.

--paul

Post Reply

Return to “iOS Deployment”