Please, we are finishing our first app/game using InApp… we are just implementing it.
But I have a doubt regarding this: we are saving some options in PlayerPrefs, as many people here… but, lets suppose the user uninstall the game from his/her iPhone/iPod, etc… the PlayerPrefs get lost after this? I mean, all the PlayerPrefs saved are erased? Or the device keeps the information and just install again the game/app when the user wants to?
We want users to buy somethings InApp store, but is there any way the user can keep with their choices? How AppleStore handle this?
BTW, Prime31, we are aiming to use your StoreKit solution if we can help us also with this, I appreciate it
If the IAP are standard items, ie non-consumable you can implement a “Restore Purchases” feature to the app. You query the app store for a list of the IAP items the user has purchased and then enable those.
Nice, gameyeti, thanks… but this query should be done by us, or Apple has somekind of feature like you said? I never experienced this, this is our first try with in apps, so I never tried to do it… we will have items to use like coins to spent in whatever and anyway players wants to, and other items simply will be like an Upgrade… this upgrades is what is concerning us… we want the player keeps with the upgrades he/she bought…
if the player deletes the app and then donwloads it again or downloads an update then yes the in app purchases are lost on the device. BUT if you make sure your app has a restore in app purchases button that gets the pre owned items from apple, then all the player needs to do is press it and enter his password twice.
If the player doesn’t delete the app first and you stored the purchases in playerprefs then he will still have them when he upgrades the app.
Also what I’ve found is you don’t really even need to have a restore all function because if the player deletes and then re downloads the app, when he tries to purchase the in app stuff again he gets presented with an apple message saying he already owns it and do you want to download it again. This doesnt re charge the user.
Here is what I do in my apps that seems to work:
when player in app purchases, store the fact he did in playerprefs and use that info next time the app starts to not present that purchase option again.
If when the app is run absolutly no in apps are stored in your player prefs offer a restore all button.
if restore all is ever used then store the fact in playerprefs and dont offer it on future runs.
Thanks, Arkon.
Good to know about the user already own when trying to buy again…
We will sure test it before release the game.
I just dont get it about last 2 lines:
“If when the app is run absolutly no in apps are stored in your player prefs offer a restore all button.”
“if restore all is ever used then store the fact in playerprefs and dont offer it on future runs.”
What do you mean?
what he means is that you could hide the restore buttons if you detect that there are known IAP present already.
But I would vote against that. As per apple guidelines you should ALWAYS offer a restore button. You can never be sure that 100% is restored. What if they bought the IAP on another device and now want to use it on this one (in which case they are entitled to get it too for non-consumables)? his solution then would prevent the restore button from showing up despite being needed
Thanks a lot dreamora… do you have any suggestions for us? We really want the player enjoys whatever he bought, and have it “lifetime”… but a restore button (for real) will need somekind of iCloud support, as prime31 said, right?
No you don’t need icloud for a restore all function. Apple remembers all purchases so your restore all function just needs to request all previously owned items from apple using storekit, or if you are using Prime31’s plugin, there is a function for it in the plugin.
One word of warning, you must abort the in app purchase or restore if the player presses the IOS dialog cancel button otherwise apple will fail the app.
If I use PlayerPrefs to remember player purchase, it seems I should encryption the data before saving otherwise it would be too easy to hack fake purchase?
Also, if the player purchased some consumables, and not use it before uninstall-install, he effectively lost his consumable and nothing can be done about it, right?
If you’re concerned about security, try looking at the Unity Plug-in called easy save. It might not be 100% hack proof, but better than PlayerPrefs IMO
Although not perfect, I use something from my ASP.NET days called SecureQueryString. You write to a name/value collection and then encrypt it. That encrypted string is then saved to PlayerPrefs. When my Unity game starts, I simply decrypt it and I have my name/value collection back.
Originally this was implemented to pass variables around in the query string (http://www.blah.com?id=123) and be secure. It’s worked for me so far