![](/img/trans.png)
[英]how can i get hotspot connected devices ip address and MAC address in ios iphone swift?
[英]How to get the wifi mac address on iPhone in Swift?
有没有办法使用Swift语言获取IOS设备的真实Wi-Fi MAC地址? 非常感谢代码片段! 谢谢。
当您在iOS 7及更高版本中请求设备MAC地址时,您将始终得到相同的响应: 02:00:00:00:00:00 , Apple已针对隐私问题做出此响应。
在iOS 7及更高版本中,如果您要求提供iOS设备的MAC地址,系统将返回值02:00:00:00:00:00。 如果需要识别设备,请改用UIDevice的identifierForVendor属性。 (需要为自己的广告目的使用标识符的应用应考虑使用ASIdentifierManager的advertisingIdentifier属性。)
如果您需要唯一标识iOS设备,Apple建议切换到UDID
。 在Swift
你可以使用这个:
UIDevice.currentDevice().identifierForVendor
如果你想要一个字符串而不是使用:
UIDevice.currentDevice().identifierForVendor.UUIDString
这是关于UDID的一个很好的阅读
自iOS 7以来,由于隐私风险,Apple不再允许开发人员访问任何特定于设备的标识符。
由于某些安全问题,您无法获取mac地址。 您可以使用UUID来唯一地识别设备。
对于swift 4.2
UIDevice().identifierForVendor?.uuidString ?? ""
为客观的c
[[[UIDevice currentDevice] identifierForVendor] UUIDString]
对于 iOS 15,请执行以下操作:
UIDevice.current.identifierForVendor?.uuidString
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.