In addition to the solutions mentioned above, I ran into a different variant of this issue.
My organization identifier changed (may be related to accepting the latest agreement update on developer.apple.com) and so the prefix for my app changed. So whereas before it was maybe ABCCYZ0U812.com.whatever.app
now it was 90210SUXX11.com.whatever.app
When I went to go submit and you get the screen that says "Sends (app name) to Apple" and there's a listing called "Binary and Entitlements", when I would expand the listing under my app (twice, since I guess Xcode has a bug the first time) I would see something like
AppName.app (5 entitlements) (provisioning profile) (arrow)
application-identifier
90210SUXX11.com.whatever.app
...
keychain-access-groups
ABCCYZ0U812.com.whatever.app
com.apple.developer.team-identifier
90210SUXX11
So for some reason it was still using the old team identifier for the keychain-access-groups
bit but that now didn't match the new team identifier
I did the following
- Clicked the arrow next to the provisioning profile to open Finder to the place where the profiles are held
- Deleted all the .mobileprovision files in that directory
- Closed out of submission dialog
- In Xcode, Click Xcode -> Preferences -> Accounts and had my account re-download the provisioning profiles
- Tried to submit the archive again
Now everything matched and it worked
AppName.app (5 entitlements) (provisioning profile) (arrow)
application-identifier
90210SUXX11.com.whatever.app
...
keychain-access-groups
90210SUXX11.com.whatever.app
com.apple.developer.team-identifier
90210SUXX11
There may be a more delicate way to fix it without deleting everything but that should put you on the right track.