Question

We have an app where we offer consumable in-app purchase which is in the form of virtual currency. (e.g. 100 coins) The in-app currency is used for some of the advanced features in the app and the user can replenish them as needed.

We are looking for a way to reliably track the virtual currency (surviving reinstalls) and are leaning towards a server based solution where we can track these in a database. The other factor in play here is that we want to reduce the friction in the app so there is no login, registration or fb connect.

We ran into one issue with this approach: - We need to find a unique identifier associated with the "device" that will survive reinstalls.

Also, we realize that this approach wouldn't support synching the currency balances across multiple devices of a single user. Any way to tie this data to user's appstore account?

Was it helpful?

Solution

  1. Generate a fingerprint when a user logs in to a particular device for the first time.

  2. Save this fingerprint in the keychain with the with the value "kSecAttrAccessibleWhenUnlockedThisDeviceOnly" for the "kSecAttrAccessible" key.

Things to consider,

  • Item will keychain will persist even user deletes the app

  • Keychain Items are backed up and restorable even to other device by since you using the above key the fingerprint would not be restored to the other devices.

  • If the devices ownership is changed then replace it with a new one for the new user or associate with the new user.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top