Hi…
I’m struggling with Sign in With Apple and the problem is exacerbated by it being in a Qt6 / C++ MacOS app which uses ObjC to do interact with Apple Frameworks. Outsude XCode, of course, because we use QT Creator.
I’m pretty sure that I set it up correctly by implementing an
@interface CWAppleAuthenticationServiceImpl : NSObject <ASAuthorizationControllerPresentationContextProviding,ASAuthorizationControllerDelegate>
- (id)initWithOwner:(MyAppleAuthenticationService *) owner;
and all the rest.
Code compiles an runs, and when when I call
[controller performRequests]
the
presentationAnchorForAuthorizationController
gets called.
But nothing visible happens in the app. Instead it jumps right into didCompleteWithError
, so I guess I did connect everything correctly – except that it doesn’t work correctly.
So I sign the app, providing the entitlements
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>com.apple.developer.applesignin</key>
<array>
<string>Default</string>
</array>
</dict>
</plist>
Signing and Notarisation works, but when I start the app, it crashes. The entitlesments are part of the app, i checked that with codesign which claims that everything is fine.
The crash appears to be the same as described in https://forums.developer.apple.com/forums/thread/698870, i.e. "Error of invalid code signature" . This is backed by me signing it without entitlements, which yields a working and running application, albeit without signIn capabilities.
I’m a bit stumped.
So I sign the app, providing the entitlements
Yeah, that’s not going to work )-: There’s a lot to unpack here. Let’s start with your deployment channel. macOS supports two deployment channels:
-
Mac App Store
-
Direct distribution, using Developer ID signing
Sign in with Apple is only supported by the first. This is documented in Developer Account Help > Reference > Supported capabilities (macOS).
Assuming you are targeting the Mac App Store, you need to understand that the Sign in with Apple entitlement (com.apple.developer.applesignin
) is a restricted entitlement. That means that it must be authorised by a provisioning profile [1]. So, to use the entitlement you must:
-
Allocate an App ID.
-
Enable the capability on that App ID.
-
Create a provisioning profile for that App ID.
-
Embed the profile in your app.
-
Sign the app with the App ID entitlement and the Sign in Apple entitlement, so that the system can match up your code to your profile.
If you were using Xcode, it’d do this all for you automatically. As you’re not, you’ll have to do it yourself. See Creating distribution-signed code for macOS for general instructions.
I also have links to a lot of other documentation and so on in Code Signing Resources. Specifically, TestFlight, Provisioning Profiles, and the Mac App Store has more details on the App ID part of this.
Share and Enjoy
—
Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"
[1] TN3125 Inside Code Signing: Provisioning Profiles talks about this in gory detail.