I don't know exactly what forces a refresh, but in the past, these things seemed to help:
- Deleting all provisioning profiles in Xcode and pressing the Download All button regenerated the profiles (e.g. As a member, I pressed the Create button to create the development certificate, then pressing the Download All button added the newly created certificate to the managed profile.)
- Adding a new device via the online portal seemed to regenerate the managed profiles to include the newly added device.
- Pressing the Fix Issue button in Xcode in the target settings.
- Try building to device and press the Fix Issue button when Xcode presents that option.
Sometimes you'll get in a state where everything gets regenerated except for the one with the app id you really need. The provisioning profile doesn't show up in Xcode, and no matter what you do, it stays stuck in the invalid state.
WARNING: The following may be very hard to undo, so do so at your own risk!
In that case, you could try deleting the provisioning profile on the Apple Developer Center and hope that the Fix Issue button in Xcode will regenerate it. I've seen it work before, but in some cases, I've seen it give this error with no means of recovery:
An App ID with Identifier 'com.example' is not available. Please enter a different string.
This may seem like you're in an even more unrecoverable situation, but I was able to regenerate it at least once by launching Xcode Beta 8 and tapping the Fix Issue button. It seems that they fixed some bugs with the Fix Issue button in the latest Xcode.
(Note: Sure you could try to delete the offending App ID and then press the Fix Issue button, but you'll invalidate all the important provisioning profiles on your account.)
If you still run in to issues, make sure that you're following these best practices.
If you run into code signing issues:
- Make sure the development certificate has been downloaded.
- Delete all invalid certificates from KeyChain.
- Delete all provisioning profiles from your machine.
- Download All the latest profiles.