Can I pass parameters to xcodebuild from Qt Creator?

Viewed 1420

My Qt and Qt Creator knowledge is horribly lacking and I'm stuck trying to rebuild our existing application to make it 64-bit for iOS 11.

When building a release version for iOS, I get the following error:

Check dependencies
Code Signing Error: No profiles for 'com.yourcompany.MYTESTAPP' were found:  Xcode couldn't find any iOS App Development provisioning profiles matching 'com.yourcompany.MYTESTAPP'. Automatic signing is disabled and unable to generate a profile. To enable automatic signing, pass -allowProvisioningUpdates to xcodebuild.
Code Signing Error: Code signing is required for product type 'Application' in SDK 'iOS 11.0'

I tried to replace com.yourcompany in Info.plist but it appears that file is generated automatically on every build, so changes there are overridden. Is there another way to replace that domain with our domain?

The easiest solution would probably be to do what the error suggests and pass -allowProvisioningUpdates to xcodebuild, but I can't figure out how... Plus I can't find any helpful articles on the subject.

I did find this SO question but the answers there are way too advanced for a beginner like myself. I tried the following based on the accepted answer, without any effect:

contains(MYDEFINES, iOS) {
    QMAKE_CXXFLAGS += -allowProvisioningUpdates
}

EDIT: it's probably important to know that I did enable "Automatically manage signing" Qt Creator's Build Settings. And that I'm on Qt 5.9.1 and Qt Creator 4.4.0.

2 Answers

Yes you can pass data from your .pro project file to your Info.plist. When you run QMake, this builds your Xcode project file and passes through the settings for Xcode. So it is QMake that's important, rather than Qt Creator.

There have, unfortunately, been changes and bugs (e.g. QTBUG-70072) and there are also omissions from the documentation.

As of Qt 5.11.2, here is how to set the bundle (and some other fields):

QMAKE_INFO_PLIST = path/to/your/Info.plist
QMAKE_TARGET_BUNDLE_PREFIX = com.yourcompany
QMAKE_BUNDLE = yourapp
QMAKE_IOS_DEPLOYMENT_TARGET = 11.0
QMAKE_APPLE_TARGETED_DEVICE_FAMILY = 1

If you don't set QMAKE_BUNDLE, QMake will use your TARGET. In my case, my app bundle ID is all lowercase whereas my TARGET is not, and the bundle is case-sensitive.

QMAKE_IOS_DEPLOYMENT_TARGET sets the minimum iOS version.

QMAKE_APPLE_TARGETED_DEVICE_FAMILY sets the device family: 1 for iPhone, 2 for iPad, 1,2 to support both.

Within your Info.plist, you should have:

<key>CFBundleIdentifier</key>
<string>${PRODUCT_BUNDLE_IDENTIFIER}</string>

The official documentation relating to Info.plist is on the QMake Variables Reference page.

Related