作者热门文章
- r - 以节省内存的方式增长 data.frame
- ruby-on-rails - ruby/ruby on rails 内存泄漏检测
- android - 无法解析导入android.support.v7.app
- UNIX 域套接字与共享内存(映射文件)
有没有办法用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/
我是一名优秀的程序员,十分优秀!