将iOS应用限制为只能在一个设备上安装 [英] Limiting an iOS app to installation on only one device
问题描述
我有一个用Swift编写的iOS应用程序,我只想将每个帐户限制在一个设备上-我可以采取什么方法来限制此访问权限?我正在使用Firebase并具有登录系统,但是该登录系统未链接到Firebase Auth.
I have an iOS app written in Swift where I want to limit each account to one device only – what is a way that I could go about limiting this access? I'm using Firebase and have a login system but the login system is not linked to Firebase Auth.
推荐答案
我通过研究发现,一种可行的方法是通过以下方式将设备的uid存储在应用程序(或NSUserDefaults)中使用的数据库中: UIDevice.current.identifierForVendor!.uuidString
.然后,当用户登录时,将uuid与设备的uuid进行比较,并采取适当的措施.
One option that also works, that I found through research, is to store the uid of a device in the database used in the app (or in NSUserDefaults) via UIDevice.current.identifierForVendor!.uuidString
. Then, when a user logs in, compare the uuid with the device's uuid and take the appropriate action.
这不是万无一失的-如果用户卸载并重新安装该应用程序,则会为他们分配另一个uuid.但总的来说,这是最好的方法.
This is not foolproof – if the user uninstalls the app and re-installs it, they will be assigned a different uuid. But in general, this is the best approach.
这篇关于将iOS应用限制为只能在一个设备上安装的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!