将 iPhone 应用程序的投票限制在特定 iPhone 设备上

发布于 2024-10-06 15:33:40 字数 298 浏览 3 评论 0原文

我正在开发一个 iPhone 客户端应用程序,它允许用户对各种服务进行评分。无需注册或登录。

要求是用户不能重复对服务进行评分(尽管可以更改其评分)。从目前的情况来看,该应用程序可以被删除、重新安装,用户可以再次投票。

我们考虑过使用设备 ID,但一位同事提到 Apple 建议不要这样做。如果我理解正确的话,万一手机被退回商店、重新发行,然后新用户下载了相同的应用程序。对我来说这似乎是一个非常边缘的情况,但我想可能会发生在企业内部。

有没有一种聪明的方法来限制投票到特定设备?也许使用钥匙扣?

任何指示都非常感激。

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.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

满栀 2024-10-13 15:33:40

请务必注意 UDID 和 UUID 之间的区别。

UDID“唯一设备ID”是特定于硬件的。对于特定设备,它永远不会改变。因此,它已成为隐私问题,苹果正在阻止尝试使用它的应用程序。因此,Apple 生成了一个可选择退出的“设备 ID”哈希值,特别是用于广告用途。这个新的 ID 哈希称为 IFA,在 iOS 6.0+ 中可用。

UUID“通用唯一 ID”不是特定于硬件的。它是用于识别设备的哈希值;但不是特别绝对值。例如,PhoneGap根据设备属性生成UUID;这就是你执行 device.uuid 时得到的结果。如果您删除该应用程序并重新安装,您将获得一个新的 id 哈希值。 Apple 并未阻止 UUID。

我认为针对您的情况,最好的解决方案是使用 IFA,并使用 OpenUDID 作为 iOS 的备份。 6.0。

这是我们使用的代码。如果 IFA 不可用,请获取 OpenUDID。您必须安装 OpenUDID,请在此处了解更多信息,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];
}

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];
}
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文