gpt4 book ai didi

ios - 如何在 Swift 中获取 iPhone 上的 wifi mac 地址?

转载 作者:IT王子 更新时间:2023-10-29 05:20:49 32 4
gpt4 key购买 nike

有没有办法用Swift语言获取IOS设备的真实Wi-Fi MAC地址?非常感谢代码片段!谢谢。

最佳答案

当您在 iOS 7 及更高版本中请求设备 MAC 地址时,您将始终得到相同的响应:02:00:00:00:00:00,这由 Apple 完成出于隐私考虑。

In iOS 7 and later, if you ask for the MAC address of an iOS device, the system returns the value 02:00:00:00:00:00. If you need to identify the device, use the identifierForVendor property of UIDevice instead. (Apps that need an identifier for their own advertising purposes should consider using the advertisingIdentifier property of ASIdentifierManager instead.)

如果您需要唯一标识 iOS 设备,Apple 建议改用 UDID。在 Swift 中你可以使用这个:

UIDevice.currentDevice().identifierForVendor

如果你想要一个字符串而不是使用:

UIDevice.currentDevice().identifierForVendor.UUIDString

Here是一本关于 UDID 的好书

关于ios - 如何在 Swift 中获取 iPhone 上的 wifi mac 地址?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29163110/

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