Cloudkit: FetchUserRecordIdWithCompletionHandler returns the previous user ID


I have a problem with fetchUserRecordIdWithCompletionHandler when I logout of my Icloud account and sign in with another account and return to my app. And I fetch the users record Id again to update the data, then it fetches the previous id from the user that signed out and not the id of the new user. I presume that cloudkit is caching the user id and it doesn't update it when the user signs out and signs in with another id.

However when the app is terminated and opened again it does recognise the new id.

Anyone know how to solve this problem or is this a bug.

Thanks in advance

I had the same problem and it was solved after updating XCode to 7.1!