Question

I am working on a client iPhone app which allows users to rate various services. There is no registration or login.

The requirement is that a user can not repeatedly rate a service(although can change their rating). As things currently stand the app could be deleted, re-installed and the user could vote again.

We considered using the device id, however a colleague mentioned that Apple recommend against this. If I understand correctly in case a phone was returned to store, re-issued, and the new user then downloaded the same app. Seems like a pretty edge case to me, but I guess could happen within an enterprise.

Is there a smart way to restrict voting to a particular device? Perhaps using the keychain?

Any pointers greatly appreciated.

Was it helpful?

Solution

Its important to note the difference between a UDID and a UUID.

UDID "unique device id" is hardware specific. It never changes for a particular device. For this reason, it has become a privacy concern and Apple is blocking apps that try to use this. As a result, Apple has generated an opt-out-able "device id" hash, particularly for advertisement usage. This new ID hash is called IFA and is available in iOS 6.0+.

UUID "universally unique id" is not hardware specific. It is a hash used to identify a device; but not particularly an absolute value. For example, PhoneGap generates a UUID based on device properties; this is what you get when you do device.uuid. If you delete the app and reinstall, you will get a new id hash. UUID is not being blocked by Apple.

I think the best solution in your case would be to use the IFA, with OpenUDID as a backup for iOS < 6.0.

Here is the code we use. If IFA is not available, get OpenUDID. You must install OpenUDID, read more about that here, https://github.com/ylechelle/OpenUDID.

NSString* uuid = nil;
if ([[UIDevice currentDevice] respondsToSelector:@selector(identifierForVendor)]) {
    // IOS 6 new Unique Identifier implementation, IFA
    uuid = [[[UIDevice currentDevice] identifierForVendor] UUIDString];
} else {
    // Before iOS6 (or if IFA disabled) you shoud use a custom implementation for uuid
    // Here I use OpenUDID (you have to import it into your project)
    // https://github.com/ylechelle/OpenUDID
    NSString* openUDID = [OpenUDID value];
    uuid = [OpenUDID value];
}
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top