react-native ios获取mac地址

Ser*_*urt 3 react-native react-native-ios

在react-native应用程序中,我使用react-native-device-info库获取设备的MAC地址。

但是我只能获取Android设备的mac地址。我找不到用于获取iOs设备的mac地址的库。

如何获取iOs设备的MAC地址?

Hen*_*all 5

在iOS 7或更高版本中无法做到这一点,引用apple

在iOS 7及更高版本中,如果您要求提供iOS设备的MAC地址,系统将返回值02:00:00:00:00:00。如果需要标识设备,请改用UIDevice的identifierForVendor属性。


相反,您应该使用“ identifierForVendor”,它可以与react-native-device-info一起接收:

import DeviceInfo from 'react-native-device-info'; 

const uniqueId = DeviceInfo.getUniqueID();
Run Code Online (Sandbox Code Playgroud)