ios - 用于识别用户的 UDID 号码

标签 ios objective-c udid

你好 StackOverflow 成员 :) 我想知道是否可以通过调用网络服务发送 UDID 号码来验证我的应用程序的用户?

在我的数据库中,我会将 UDID 作为主键,并将可用信用数引用到该键。

苹果允许吗?如果是,我如何以编程方式获取 UDID?

最佳答案

可以获取到序列号但是我觉得不建议使用UDID

对于序列号,您可以使用此代码

- (NSString*)getSerialNumber
{
    CFTypeRef serialNumberAsCFString;
    io_service_t platformExpert = IOServiceGetMatchingService(
        kIOMasterPortDefault, IOServiceMatching("IOPlatformExpertDevice"));
    if (platformExpert)
        {
            serialNumberAsCFString = IORegistryEntryCreateCFProperty(
                platformExpert, CFSTR(kIOPlatformSerialNumberKey), 
                kCFAllocatorDefault, 0);
        }
    IOObjectRelease(platformExpert);
    NSString *serial = 
        [[NSString alloc] initWithFormat:@"%@",serialNumberAsCFString];
    return serial;
}

Reference for the code

但是您可以尝试使用这行代码来获取 UDID,我不确定它是否会给出所需的结果。 Apple 可能会拒绝该应用,并且此 UDID 功能在较新版本的 iOS 中已弃用。

NSString *uid;
uid= [[UIDevice currentDevice] uniqueIdentifier];
NSLog(@"udid is %@",uid);

关于ios - 用于识别用户的 UDID 号码,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15281861/

相关文章:

ios - 带有 NSFetchedResultsController 错误的 moveRows

ios - camera.activeFormat 未得到应用

iphone - 如何在 UISearchBar 变为事件状态时展开它

ios - 无法从 iPhone Xs Max 获取 UDID | iOS |苹果 |苹果手机

iphone - 如何在没有 UDID 的情况下跟踪 iOS5 上的下载

ios - swift "timer"变量

ios - 使用单词列表进行多语言文字游戏的最佳方式

objective-c - NSDictionay 总是返回 nil

ios - QuickBlox 消息 UDID

ios - viewDidAppear 时突出显示