[英]How can I banned an iOS & Android devices from login to my app
I am looking for a way to ban iOS and Android devices from using my application on their devices.我正在寻找一种方法来禁止 iOS 和 Android 设备在他们的设备上使用我的应用程序。
by using IMEI
or UUID
or how can do it.通过使用
IMEI
或UUID
或如何做到这一点。
Snapchat blocked users' devices on iOS and Android how do they do it what is the methods they chose for? Snapchat 在 iOS 和 Android 上阻止了用户的设备他们是如何做到的,他们选择的方法是什么?
Now we can not get UUID or IMEI of Android/iOS device, because System doesn't allow us.现在我们无法获取 Android/iOS 设备的 UUID 或 IMEI,因为系统不允许我们。
In iOS, you can save data (key-value) in Keychain, which is persisted until you reset to factory setting for restore.在iOS中,您可以将数据(key-value)保存在Keychain中,直到您恢复出厂设置才能恢复。 So you can mostly use it as device's identifier.
因此,您通常可以将其用作设备的标识符。
Here is a simple and useful lib that help you to write/read something to/from Keychain of an iOS device.这是一个简单而有用的库,可帮助您向 iOS 设备的钥匙串写入/读取内容。
Example:例子:
let deviceId = UUID().uuidString
let keychain = Keychain(service: "com.example.github-token") // you can put whatever but I recommend to use your app's bundleId
keychain["device_id"] = deviceId // save it.
// In you API request function
let keychain = Keychain(service: "com.example.github-token") // same above
let deviceId = keychain["device_id"]
// Then submit this deviceId to BE then you can verify that if this device is on the whitelist or blacklist.
// If it is on blacklist, just return error to client.
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.