gpt4 book ai didi

ios - 如何以编程方式获取 iOS 设备 MAC 地址

转载 作者:IT王子 更新时间:2023-10-29 08:18:26 25 4
gpt4 key购买 nike

如何在我的应用程序中以编程方式获取 iOS 设备的 MAC 代码?

最佳答案

现在 iOS 7 设备 – 始终返回 02:00:00:00:00:00 的 MAC 地址。

所以最好使用[UIDevice identifierForVendor]

最好调用这个方法来获取app specific unique key

类别会更合适

#import "UIDevice+Identifier.h"

- (NSString *) identifierForVendor1
{
if ([[UIDevice currentDevice] respondsToSelector:@selector(identifierForVendor)]) {
return [[[UIDevice currentDevice] identifierForVendor] UUIDString];
}
return @"";
}

现在调用上面的方法获取唯一地址

NSString *like_UDID=[NSString stringWithFormat:@"%@",
[[UIDevice currentDevice] identifierForVendor1]];

NSLog(@"%@",like_UDID);

关于ios - 如何以编程方式获取 iOS 设备 MAC 地址,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14827365/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com