如何在expo项目上获取MAC地址?

问题描述 投票:0回答:2

***当我想使用 expo-NETWORK 获取 mac 地址时, 它要求***“承诺” 代码 : ` const ipAlert = async () => { 尝试{

      const ip = await Network.getMacAddressAsync('wlan0')()
    
  } catch (error) {
    console.log('That did not go well.')
  }
  };`
javascript reactjs react-native expo mac-address
2个回答
1
投票

getMacAddressAsync()
调用返回一个承诺,您需要像这样处理:

Network.getMacAddressAsync()
        .then(macAddress => {
             console.log(macAddress)
         })
         .catch(error => console.log(error))

0
投票

我可以这样获取mac地址吗?因为我听说 android/ios 在这方面变得更加严格,目前我没有看到任何方法在 expo api 上获取 MAC 地址。那么现在我可以得到还是不能得到?

© www.soinside.com 2019 - 2024. All rights reserved.