iPhone/iPad 唯一标识符除了 UUID/UDID 之外?

发布于 2024-10-31 06:23:09 字数 229 浏览 0 评论 0 原文

我正在进行的项目要求 iPhone 或 iPad 提供两个(甚至三个)唯一标识符。我知道,我知道...UDID 应该足够了,但我们正在尝试查看是否有任何其他可以使用的唯一标识符。

我可以使用 IOKit.framework 从手机获取 IMEI、序列号、MAC 地址等,但显然 Apple 对此不赞成,任何使用此框架的应用程序都将被拒绝。

有人有任何其他想法或我缺少的可以使用的标识符吗?

谢谢!

The project I am on is requesting two (or even three) unique identifiers from the iPhone or iPad. I know, I know... the UDID should be enough but we are trying to see if there are any other unique identifiers that we can use.

I can get the IMEI, serial number, MAC Address, etc. from the phone using the IOKit.framework but apparently this is frowned upon by Apple and any app using this framework will be rejected.

Does anyone have any other ideas, or identifiers that I am missing that could be used?

Thanks!

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

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

发布评论

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

评论(6

蹲在坟头点根烟 2024-11-07 06:23:09

这个问题很老了,但是现在添加了一个新的、基于供应商的唯一标识符来替换 iOS 6 中已弃用的 UUID。

[UIDeviceidentifierForVendor] 而不是 < a href="http://developer.apple.com/library/ios/documentation/uikit/reference/UIDevice_Class/DeprecationAppendix/AppendixADeprecatedAPI.html#//apple_ref/occ/instp/UIDevice/uniqueIdentifier" rel="noreferrer"> [UIDevice uniqueIdentifier] 自 iOS 5.0 起已弃用

示例用法:

NSUUID *uuid = [[UIDevice currentDevice] identifierForVendor];
NSString *uuidString = [uuid UUIDString];

This question is old however a new unique, vendor based, identifier has now been added to replace the deprecated UUID in iOS 6.

The [UIDevice identifierForVendor] should now be used instead of [UIDevice uniqueIdentifier] which is now deprecated as of iOS 5.0

Example usage:

NSUUID *uuid = [[UIDevice currentDevice] identifierForVendor];
NSString *uuidString = [uuid UUIDString];
心的憧憬 2024-11-07 06:23:09

您可以获得 ICCID 和 IMSI(如果存在)。

NSString *commcenter = @"/private/var/wireless/Library/Preferences/com.apple.commcenter.plist";
NSDictionary *dict = [NSDictionary dictionaryWithContentsOfFile:commcenter];
NSString *ICCID = [dict valueForKey:@"ICCID"];
NSString *IMSI = [dict valueForKey:@"IMSI"];

我想这就是你所能得到的。我不知道还有其他获得通用 ID 的方法。

2013 年 3 月 13 日更新:
自从我大约两年前写下这个答案以来,这可能已经发生了变化。我什至不记得当时的iOS版本是什么。另外,正如 @joshis 在评论中正确指出的那样,“您不能合法地这样做,因为您的应用程序会从应用程序沙箱外部读取内容,因此,它将被拒绝,如 AppStore 审查指南中所指定的......”。

You can get the ICCID and the IMSI (if they exist).

NSString *commcenter = @"/private/var/wireless/Library/Preferences/com.apple.commcenter.plist";
NSDictionary *dict = [NSDictionary dictionaryWithContentsOfFile:commcenter];
NSString *ICCID = [dict valueForKey:@"ICCID"];
NSString *IMSI = [dict valueForKey:@"IMSI"];

I think that's as far as you will get. I don't know any other options for getting an universal ID.

UPDATE 2013-03-13:
This has probably changed since I wrote this answer almost two years ago. I don't even remember what was the iOS version at the moment. Also as @joshis correctly pointed out in the comments "You cannot legally do this, since your app would read stuff from outside the application sandbox and therefore, it will be rejected, as specified in AppStore Review Guidelines...".

枫林﹌晚霞¤ 2024-11-07 06:23:09

来自苹果:

当应用程序(或另一个
来自同一供应商的应用程序)安装在 iOS 设备上。价值
当用户从应用程序中删除该供应商的所有应用程序时更改
设备,然后重新安装其中一个或多个。

因此,如果您使用[UIDeviceidentifierForVendor]并且用户删除应用程序并重新安装它,则ID将会不同(因此没有真正的物理设备跟踪)

为什么不使用SecureUDID?

NSString *domain = @"com.example.app";
NSString *key = @"mykey";
NSString *udid = [SecureUDID UDIDForDomain:domain usingKey:key];

这样,即使用户删除应用程序并重新安装,UDID 也将是相同的。这将为您提供一致的跟踪(或您想要使用 UDID 执行的任何操作)。
顺便说一句,上述行为仍然是苹果允许的。
玩得开心。

From Apple:

The value in this property remains the same while the app (or another
app from the same vendor) is installed on the iOS device. The value
changes when the user deletes all of that vendor’s apps from the
device and subsequently reinstalls one or more of them.

So if you use [UIDevice identifierForVendor] and the user delete the app and reinstall it, the id will be different(so no real physical device tracking)

Why don't you use SecureUDID?

NSString *domain = @"com.example.app";
NSString *key = @"mykey";
NSString *udid = [SecureUDID UDIDForDomain:domain usingKey:key];

This way, even if the user delete the app and reinstall it, the UDID will be same. This will give you consistent tracking(or whatever you want to do with the UDID).
Btw, the above is still permitted from Apple.
Have fun.

春庭雪 2024-11-07 06:23:09

获取 UDID 的方法已被弃用,您现在应该使用 CFUUIDCreate 我认为可以多次使用它来获取更多标识符(如果需要)

The method for getting the UDID is being deprecated, you should now use CFUUIDCreate which I think could be used multiple times to get more identifiers if needed

绮烟 2024-11-07 06:23:09

也许你应该澄清你的问题。

从 iPhone 或 iPad 请求两个(甚至三个)唯一标识符

……在术语上是矛盾的。如果您的目的是跟踪特定的物理设备,那么根据定义,单个唯一标识符就足够了。这就是独特的意思。

也许,您真正想要的是跟踪每个用户使用您的应用程序(而不是设备)的多项信息。假设您的联网游戏应用程序允许用户拥有 1、2 或 3 种不同的个性。当用户创建独特的个性时,您必须在所有其他用户的个性中跟踪该用户的每个个性。

出于这种目的,生成并存储 UUID* 是一种正确且常见的解决方案。 iOS 包含用于生成 UUID 值的库。唯一的问题是,如果用户删除并重新安装应用程序,该 UUID 的存储可能会丢失。针对这一挑战有一些解决方法,您可以通过谷歌搜索有关用生成的 UUID 值替换 UDID 跟踪的讨论来了解这些方法。


这个问题有点老了。所以我应该提到:在 iOS 5 中,Apple 已弃用 UDID 的使用。自 2013 年 5 月 1 日起,Apple 拒绝任何访问 UDID 的应用程序。


(*) 不要将 UUID 与 UDID 混淆。 UUID 是标准 128 位(32 个十六进制数字)数字,通常用作虚拟许多技术场景中的唯一标识符。 UDID 是 Apple 刻录到每个 iOS 设备中的 40 个十六进制数字字符串,用于唯一标识每个设备。

Perhaps you should clarify your question.

requesting two (or even three) unique identifiers from the iPhone or iPad

…is a contradiction in terms. If your purpose is to track a specific physical device, then a single unique identifier, by definition, is enough. That’s what unique means.

Perhaps, what you really want is to track multiple things about each user’s use of your app, as opposed to the device. Say your networked game app allows the user 1, 2, or 3 different personalities. As they user creates a distinct personality, you must track each of that user's personalities amongst all the other user’s personalities.

For this kind of purpose, generating and storing a UUID* is a proper and common solution. iOS includes libraries to generate a UUID value. The only catch is that if the user deletes and re-installs the app, the storage of that UUID may be lost. There are workarounds for this challenge, which you may learn about by googling for discussions of replacing UDID tracking with generated UUID values.


This question is a bit older. So I should mention: In iOS 5, Apple deprecated the use of the UDID. As of 2013-05-01 Apple is rejecting any app that accesses the UDID.


(*) Do not confuse a UUID with a UDID. UUID is a standard 128-bit (32 hex digits) number often used as a virtually unique identifier in many technology scenarios. UDID is Apple's 40 hex digit string burned into every iOS device to uniquely identify each device.

哥,最终变帅啦 2024-11-07 06:23:09

iOS 11 中的 DeviceCheck API 是一个有趣的获取唯一标识符的解决方案,它的优点是 - 即使应用程序卸载后,该值也会保留。因此,开发人员可以有效地控制试用安装和奖励等用例。

DeviceCheck API in iOS 11 is an interesting solution to get unique Identifier, the advantage it has is - the value will be retained even after the app in uninstalled. So use cases like trial installation and rewards can be effectively controlled by developers.

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