Using the keychain for something other than it's intended purpose will get your app rejected if Apple notices that you're doing it. The only question is whether or not they will notice, I don't know.
Since this also violates the user's privacy, there is some risk your developer account might also be deleted. Apple doesn't like it when App developers do violate user privacy. Apple has previously been very harsh with developers who do stuff like what you're proposing.
The correct method for tracking a user is to ask the user to enter a username or email address. Anything else is trying to dodge Apple's restrictions on what app developers are allowed to do.
You need to make it clear that a user is creating an account on your server, and you need to give the user control over that account. Also just because two devices are using the same keychain does not mean those devices are used by the same person — so it's definitely not correct to use keychain or anything related to iCloud.
You can use the identifierForVendor
property on the UIDevice
property to identify an individual device. If you want to link multiple devices to a single account, then you've got to let the user do that. There is no alternative, without risking app rejection. Apple specifically does not want developers to do that, although they have trouble enforcing this rule.
Also note that you're not allowed to use identifierForVendor
for advertisements. It must never be shared with any advertisement system. There is a separate identifier for that, which the user can opt out of.