Set Version and Build for IOS using QT
when I build the IOS application From my QT it was working correctly, but lately, I added some .pro settings to my IOS to set ICON, Bundle ID, and all of this works pefect, after this the generated Xcode project was generated without Version Number which let me just build and open the Build in Xcode to Edit the Version so I can deploy on Simulator, Here is my .pro I use
ios {
QMAKE_INFO_PLIST = $$PWD/ios/Info.plist
QMAKE_ASSET_CATALOGS += $$PWD/ios/Images.xcassets
ios_icon.files = $$files($$PWD/ios/Assets.xcassets/AppIcon.appiconset/*.png)
QMAKE_BUNDLE_DATA += ios_icon
app_launch_screen.files = $$files($$PWD/ios/MyLaunchScreen.storyboard)
QMAKE_BUNDLE_DATA += app_launch_screen
QMAKE_TARGET_BUNDLE_PREFIX = myperfix_of_ID
# Set "Devices" (2=iPad Only)
#Note for devices: 1=iPhone, 2=iPad, 1,2=Universal.
QMAKE_IOS_TARGETED_DEVICE_FAMILY = 1
}
What I tried is to add to it both of this
QMAKE_SHORT_VERSION = 2
QMAKE_FULL_VERSION = 2
but both never worked and generate the Xcode project without version or build change, so what I did wrong or I missing in my .pro setting to change the build and add the version number, without those setting to add icon and splash screen, it generated a default 1.0.0 for build and version
so this is annoying because I cant directly deploy from QT and I need to go and open the build in Xcode to add version then run from there, because if I run again from QT it will overwrite the setting.
Error on running from QT
Application install on simulator failed. An error was encountered processing the command (domain=NSPOSIXErrorDomain, code=22):
Failed to install the requested application
The application's Info.plist does not contain a valid CFBundleShortVersionString.
Ensure your bundle contains a valid CFBundleShortVersionString.
building is working fine, but deploy from QT is the problem now.
Set VERSION=1.2.3 in your .pro file and add QMAKE_INFO_PLIST = Info.plist works at least for me using QtCreator 6.0.2 and XCode 13.2.1.
Use the variables in Info.plist:
<key>CFBundleShortVersionString</key>
<string>$(QMAKE_SHORT_VERSION)</string>
<key>CFBundleVersion</key>
<string>$(QMAKE_FULL_VERSION)</string>
See also QTBUG-75988