Get unique identifier (MAC address, UDID, etc…) in Adobe AIR for iOS

╄→尐↘猪︶ㄣ 提交于 2019-12-04 04:16:51

问题


I'm trying to get the MAC address for the network adapter of the user's device in an Adobe AIR Application for Android and iOS (iPad 2).

In Android it works correctly, but in iOS it doesn't. This is the code I'm using:

var vNetworkInterfaces:Vector.<NetworkInterface> = NetworkInfo.networkInfo.findInterfaces();

for each (var networkInterface:NetworkInterface in vNetworkInterfaces) {
    trace(networkInterface.hardwareAddress);
}

This works in Android, but in iOS I get this when trying to run findInterfaces():

Error #1009: Cannot access a property or method of a null object reference.

So it seems networkInfo.findInterfaces() is not implemented in iOS. I tried getting the value of:

NetworkInfo.isSupported

And the value of that is true in Android but false in the iPad 2. So it seems NetworkInfo is not supported in iOS

Is there any other way in iOS to get a unique identifier for the device? (it doesn't have to be the MAC; I just want to uniquely identify the user's device)


回答1:


Actually there is a way to get the MAC Adress on iOS too ;) : Getting NetworkInfo from both Android and iOS.




回答2:


Create your own random UID and save it on the device.

Each time app starts, see if you have already generated and stored the UID so you won't overwrite it.



来源:https://stackoverflow.com/questions/6794493/get-unique-identifier-mac-address-udid-etc-in-adobe-air-for-ios

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!