I solved the problem.First of all remove all signing accounts from Xcode > Preferences > Accounts and close Xcode. Then check in the member center of https://developer.apple.com for the accounts you want to use for signing, if the latest agreements are signed/reviewed by the account owner. For me it wasn't. After accepting the agreement open Xcode again and add the account again. I restarted Xcode again (just to be on the save side) and tried it again. This time it worked and the error didn't occur anymore.I hope this solves your problem too.
Topic:
Code Signing
SubTopic:
Certificates, Identifiers & Profiles
Tags: