如何从iOS应用获取设备ID? [英] How to get the Device ID from an iOS app?

查看:84
本文介绍了如何从iOS应用获取设备ID?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何在iOS应用中获取用户设备的唯一ID?

How can I get the unique ID of the user's device in an iOS app?

推荐答案

使用此

    UIDevice *device = [UIDevice currentDevice];
    NSString *uniqueIdentifier = [device uniqueIdentifier];


更新

Apple已弃用唯一标识符,因此现在下面的代码(从Melvin Sovereign的评论中)是合适的:

Apple has the deprecated unique identifier, so now the following code (from Melvin Sovereign's comment) is appropriate:

NSString *uniqueIdentifier = [[[UIDevice currentDevice] identifierForVendor] UUIDString];

这篇关于如何从iOS应用获取设备ID?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆