Xcode archive cannot be validated (Qt 6 with CMake)
-
If someone has been able to successfully deploy a Qt 6 + CMake app to the App Store, I could really do with your help as I've hit a brick wall.
My environment:
- MacOS Monterey (12.6) on Apple Silicon.
- Qt Creator 9.0.1
- I have tried both Qt 6.3.2 and Qt 6.4.2.
- Xcode 13.4.1. (I know the official recommendation for Qt 6.4 is Xcode 13.2.1. I'd like to use Xcode 14!)
The problem
My process is to run CMake in Qt Creator and then open the generated project in Xcode and do all the building there.I can successfully build an app that can be run on a local device (Debug or Release mode). However when I build the archive, it cannot be validated (Validate Content button greyed out) and the Details section doesn't show code signing details, only "Type: Generic Xcode Archive".
Apple documentation for this problem says:
The Archives organizer reports your archive as an app archive if it contains a single top-level app and a generic Xcode archive, otherwise.
and
You can validate and distribute an app archive. A generic archive, which may contain unexpected items such as header files, static libraries, or frameworks, can’t be validated nor distributed.
I'm not sure what this means. My app has a single executable, appMyApp, although there are over a hundred targets shown in Xcode (because of all my static libraries built in CMake as part of the project). There's no problem building and running this executable on a local device, in Debug or Release mode.
Any ideas why this is happening and what I need to do to fix it?
Possibly relevant
- When I open Xcode it asks me if I want to automatically or manually generate schema. I let it generate them automatically, but then I only use/edit the schema for appMyApp.
- I discovered that building an archive would result in errors because it couldn't find ...app/MyApp.build/release-iphone/... and that I needed to do a build for Release to generate these files before I could build the archive. I was uncertain whether it mattered if I was selecting a real device or "Any iOS Device (arm64)" for the release build, but I've tried both. I think this is related to this note in Qt documentation but the note is not at all specific about debug vs release build or device to select.
- I'm including app icons as suggested by this Qt documentation, but I don't see them when I look at the Info tab.
and when I look at the General tab, it has the option to manually generate an asset catalog. I don't recall having to do this for previous builds in Qt 5 + qmake.
I tried just using the default Info.plist, default icons and default launch screen that Qt will autogenerate if you don't provide anything, but this didn't help in any way.! - I have tried using automatic code signing (with the correct team and bundle identifier) and I notice that it uses an Apple Development signing certificate for me personally by default, which surprised me.
I also tried manually signing. There's a bug in Xcode that it shows my Apple Distribution certificate as ineligible until I quit and restart Xcode and then it correctly picks up the team signing certificate.
I'm unclear which is correct though I would presume the latter. - I notice the following warning about bundle identifiers. Does this matter?
-
For anyone encountering this problem, there appears to be a problem with Xcode 13.4.1 & 13.4.2. Upgrading to Xcode 14.2 resolved the issue. However note that you need CMake 3.24.2 or newer to work with Xcode 14.2.
More info on this in this bug report: https://bugreports.qt.io/browse/QTBUG-110621