ERROR ITMS-90164/90046: Invalid Code Signing Entitlements
If someone gets here by searching for both error ITMS-90164 and error ITMS-90046 with get-task-allow and asp-environment keys:
Like David P said, a Product -> Clean before a new Archive did solve my problem.
I just want to add that in my case I observed that the faulty xarchive was missing the following file:
Before sending that .xarchive to your client for production signature, you might want to look for the archived-expanded-entitlements.xcent file and be sure it's there.
Finally after 2 weeks of hair pulling..
For some reasons, if there is no key 'application-identifier' in the Entitlements.plist that is set to TEAMID.com.Company.CompanyAppDemo, Xamarin will use the original application-identifier, i.e. TEAMID.com.Company.CompanyApp
So the solution was to add application-identifier specifying the correct application bundle ID inside Entitlements.plist. Then include the plist in the Build Options > iOS Bundle Signing.
I had the same problem and solved with a simple Product -> Clean.
If someone gets here by searching for ERROR ITMS-90046 like me, my solution was to Clean it and delete all precompiled frameworks (the custom ones) and then build again.
Note: The error description said something about key "aps-environment" as "development".