Entitlements for multiplatform applications in Xcode 14 - ios

When creating a Multiplatform Application prior to Xcode 14, Xcode would create a separate Entitlements-file for each target. Now, with Xcode 14, all targets use the same Entitlements file by default.
After adding the HealthKit capability to an Xcode 14 project and populating the "Privacy - Health Update Usage Description" Key with a string in Info.plist, then prompting a HealthKit authorization request, the screen asking the user to agree to the App using HealthKit data does not pop up. Moreover, the following error is printed in the console: Health request display failed: Missing application-identifier entitlement.
In an effort to fix this problem, I edited the Entitlements file manually to look like this:
Adding the application-identifier entitlement to the Entitlements file manually fixes the issue, however, as the same Entitlements file is also used by the macOS target, Xcode fails to automatically sign the app for macOS and gives the following error:
Provisioning profile "Mac Team Provisioning Profile: com.xx.xx" doesn't include the application-identifier entitlement.
Here you can see the error given in Signing & Capabilities:
What is the correct approach here? Should I manually create a second Entitlements file and separate them? If so, how would this be done? Or is there something else I'm missing?
Any help would be greatly appreciated.

Testing on a real device, without manually editing the entitlements file, the error disappears and the HealthKit permission request is shown appropriately.
Therefore, I believe the behavior above is just a Xcode/Simulator bug in the current beta.

Related

com.apple.developer.contacts.notes - xCode still shows an error after getting access to the entitlement

We asked Apple to allow us to access the contact note field (com.apple.developer.contacts.notes) which was accepted (for development, we do not need to publish the test app).
We created a provisioning profile which includes com.apple.developer.contacts.notes
Added an entitlement file to the project which sets the Boolean for using that entitlement to true.
We selected manual signing and choose the provisioning profile which includes com.apple.developer.contacts.notes
It still says that com.apple.developer.contacts.notes-Entitlement is missing although it is shown correctly in xCode in the entitlement list.
Is this a bug in xCode?
xCode Version: 11.3.1
Thank you in advance!

WatchOS and location entitlement

I've been working on adding a watchapp to a fitness tracker I already have in the app store. I've been able to load it onto my physical phone and watch without trouble in the past.
I've recently added Location tracking to the watch app, so that I can track the path the user has run/biked and show it to them on the phone when they review the workout. Since doing that, I'v been getting errors from Xcode when I try to load the app to my phone; I think these are expected errors, but I'm having trouble understanding from the docs/interface of Xcode and developer.apple.com where to make the fix.
I've added the entitlement in the watch app entitlements file:
As the error says, I've switched to manual signing and generated a new provisioning profile, but I get the same error. I don't see a place to add a location capability in the provisioning profile in developer.apple.com:
It seems like the only way for the provisioning profile to get the entitlement is from Xcode, since there's not a place to add it in developer.apple.com? That seems wrong, and isn't working in any case. I'm not finding help for my case in the Xcode docs (or I'm looking in the wrong place). Any help would be greatly appreciated.
I am using location services on iOS and watchOS, but I have nothing related to it in both entitlement files. The docs say:
Set entitlement values in order to enable iCloud, push notifications,
Apple Pay, and App Sandbox.
They don’t mention location services.
So it might be enough to delete the Location entitlement, and enable automatic signing again.
Of course, you had to set in your iOS info.plist, as required, NSLocationAlwaysAndWhenInUseUsageDescription, NSLocationAlwaysUsageDescription and NSLocationWhenInUseUsageDescription, and in your watch extension info.plist NSLocationWhenInUseUsageDescription.
Are you using latest Xcode? Did you set the entitlement in the target menus? They all have toggles now, from what I remember. Once you do that, normally Xcode can resolve signing issues for you. If you look at the signing section in Xcode, does it indicate a signing problem there? (And have you restarted Xcode at least once while trying to resolve the signing problem?)
Note that the location entitlement should be on your WatchKit Extension, not on the Watchkit App.
Have a look at the Capabilities tab (it is the one for control of Entitlements, so you do not have to edit the plist directly.)
Have you tried creating a new project as a test to see if that works? Your screenshot does not match target naming of what I see in Xcode for a WatchKit App. In Xcode 10.1, the WatchKit App plist editor will show 'app name' WatchKit App and the extension plist editor shows 'appname' WatchKit Extension. I see your screenshot showing 'blank' Watchapp Extension. Possibly you edited the project name and that is not an issue? Another thing to verify is that the plist is not corrupt.

Xcode error - The executable was signed with invalid entitlements

I can build a game that I am developing in Objective-C no problem, and I can test run it when I hook my iPhone onto the macbook. But when I try to test an angular phonegap app through Xcode, I get the error:
The executable was signed with invalid entitlements.
The entitlements specified in your application’s Code Signing Entitlements file are invalid, not permitted, or do not match those specified in your provisioning profile. (0xE8008016).
I tried some settings, but it looks to me like the settings forsigning are the same as for the objective-c game. What's the catch?
I don't have an answer I was wondering if you ever found the solution to your problem. Since I can't leave a comment on your question. I'm entering it here.

iOS - How can I remove entitlements from a Framework?

I'm getting dreaded errors like this:
ERROR ITMS-90164: "Invalid Code Signing Entitlements. The entitlements
in your app bundle signature do not match the ones that are contained
in the provisioning profile. According to the provisioning profile,
the bundle contains a key value that is not allowed:
'XXXXXXXX.com.xxxxxx.xxxxxx.xxxxx' for the key
'application-identifier' in
'Payload/XXXXX.app/Frameworks/Zip.framework/Zip'"
and this
ERROR ITMS-90046: "Invalid Code Signing Entitlements. Your application
bundle's signature contains code signing entitlements that are not
supported on iOS. Specifically, value 'development' for key
'aps-environment' in
'Payload/XXXXX.app/Frameworks/iOSDFULibrary.framework/iOSDFULibrary'
is not supported."
And it only happens when archiving and uploading to the appstore. Development on a physical device works just fine.
I already tried everything on this post without success ERROR ITMS-90164/90046: Invalid Code Signing Entitlements
My specific scenario is that the errors are happening on manually installed Frameworks, while the Cocoapods frameworks seem to be fine.
I just also noticed this which made me come and create the question. Right before uploading the build to the App Store, on the final summary page, I noticed that Cocoapods frameworks look like this:
While the problematic frameworks (non cocoapods) look like this:
Those extra entitlements look like are to blame, but I can't figure out how to remove them.
EDIT Aug 3:
Just wanted to add that I found official documentation about entitlements troubleshooting here here and here
But it all talks about the app itself and not the frameworks.
Can anyone help me figure this out?
Thank you
I am facing similar issue for my app. I have used xcode10.1 to generate xcarchive and upload ipa from xcode instead of using application loader.
ERROR ITMS-90164/90046: Invalid Code Signing Entitlements has multiple solutions.

Xcode invalid entitlements on very old iOS project

The iOS project I've been tasked with upgrading was written in 2013, using Objective-C and iOS 7 SDK. I updated it for the simulator to work with iOS 10.3 but have run into a problem with entitlements when compiling for a device (which I think will be an issue when packaging for the store).
The error is the standard
The entitlements specified in your application’s Code Signing
Entitlements file are invalid, not permitted, or do not match those
specified in your provisioning profile. (0xE8008016).
but as far as I remember, iOS 7 did not use entitlements in the same way (there is no entitlements file in our old repo). How do I fix it if the project was originally so old? Everything matches as far as I can tell so I don't know why it's causing an issue.
Maybe you could try one of that:
Clean your certificate and make it again on Member Center
Look your in Target> Build Settings > Code Signing > Code Signing Entitlements to confirm the code signing is correct or updated.
Go to your Target > Capabilities. Toggle On/Off or Off/On one of the capabilities.
In this case it was overlooking a build setting that Xcode doesn't seem to fill in.
For developing on devices at least, I had to add the path to the entitlements file in the Project section of build settings, not just the Target. This is under the "Code signing entitlements" row. After adding that entry, I was able to test on my phone again.

Resources