Search code examples
iosin-app-purchaseuniqueidentifieridentifierreinstall

ios - how to prevent app from reinstalling


I make an iOS Swift app which offers some trial opportunities (e.g. 5 tries of doing something) for users to get acquainted with app capabilities. After user has run out of trial attempts, he has to buy the next ones. How can I remember the fact that the app had been installed earlier by now on the same device/with same Apple ID?

I know that UserDefaults are deleted after uninstalling, and the KeyChain data may be deleted deliberately as well.

The user has no need to register for the service he or she uses, so I don't have their credentials. UUID isn't allowed to use as I know, and identifierforvendor changes after deleting as well.

Which alternatives are possible for this case? Thanks in advance.


Solution

  • You can go with KeyChain, KeyChain will not removed after removing the application.(i.e. uninstalling application)

    You can store your counts in Keychain and when the next time user install application you can get that user has used some trials.

    Also

    Note: On iPhone, Keychain rights depend on the provisioning profile used to sign your application. Be sure to consistently use the same provisioning profile across different versions of your application.

    Referenced from - here