iOS Programing: How to save skins purchased with tokens - ios

Long story short; my friend and I are developing a small game. In this game, users can purchase tokens with actual money, and use those tokens to purchase skins/characters in our game. We have no issues keeping track of their in-app purchases; however, we are having a hard time figuring out how to save the skins that they purchased and have it displayed across all devices that they are playing the game on (we currently are using iCloud to share data such as high score, number of coins, etc to their other devices).
Any advice is appreciated.

Since you are already saving data to iCloud, I would recommend having your skins stored as an array of id's in the cloud.
So if you have 10 skins available, and they buy the 5th and 8th, save an int array with 5,8 to the cloud.
The problem here is if they delete the app on all devices it will be hard for them to recover their skins, however they should be able to restore their in-app purchases and get the tokens back, and then re-buy the skins if they want to.

Related

Avoiding a user registration system but need in app purchases and data synced

I am having trouble understanding the theory of in-app purchases and have got to the point where I read so much I have confused myself.
I have an application where I don't require the user to register however I do store data on a server and track this using the UUID. My application scrapes a hi-score system for an online game and the user has to input which players on the online game they wish to keep track of. This information is then sent to my server which scrapes the data every 24 hours by default. Here is an example of the database on my server.
Devices Table:
uuid,
scrape_interval
Players being tracked table:
uuid,
player_name
Tracking information table:
player_name,
track_data,
tracked_on
I want to include an in-app purchase which once purchased will mean that data is scraped every 12 hours instead of every 24 hours, the way I plan to do this is by updating the devices table and set the scrape_interval to 12 hours where uuid = uuid that made the purchase.
However how will this work for users that have multiple IOS devices, how do I ensure the list of players they are tracking is kept sync across devices? I have read about using an iCloud ID which is apparently a unique identifier but does this mean I will have to do a check on the launch of my app to ensure the user is logged into an iCloud account and force them to login if they aren't? This doesn't seem very user-friendly but nor does implementing a custom registration and login system.
Am I over thinking? Is there a simple solution?
In app purchases can be restored across multiple devices associated with a single itunes account. So a single purchase may actually exist on 5 devices, and you can not tell which is which.
The IAP will provide no device specific id. Your only option is to generate a unique installation id and sync all installation ids that have the paid status.

iOS: Tracking the paid users while converting paid iOS application to free with in-app purchases

We have a paid iOS application in the AppStore currently. We are planning to convert it to a free application with in-app purchases. We would want to make the in-app purchases free to the users who have already paid for the application in the previous version. I think this can be done via App Receipt Validation. But will the receipt get updated once the application is converted from paid to free and will the purchase details get lost?
If you convert your app from paid to free, you are still able to inspect the receipt and see which version was originally downloaded and act accordingly.
When we did this in one of our titles, we implemented a three tier system:
We bumped the version of the save file. Any time we promoted from a save file with version <= X (where X is the last one that was on the premium version) we would award the appropriate IAPs (in our case we gave them a coin doubler, an ad disabler and a chunk of coins). You should use this simple mechanism for the majority of the users because receipt checking can require an internet connection, and your users might not be online the first time they boot after an update.
We had a 'restore IAP' button. You need this anyway on iOS if you have any non-consumable IAPs, but we additionally added a check of the App Store receipt which lets you discover whether or not the user originally paid for the game. Here's the tutorial we based our code on, we chose the easy way, but you might need to weigh that up against piracy concerns.
Our reimbursement system also checks a file that we host, which can give out extra coins/doubler unlocks/ad removers. If the receipt checking failed (we supported pre-iOS 7 so we couldn't rely on receipt checking APIs) then we could reimburse users that way if they contacted us. This is a good idea anyway, with luck you'll have a lot more users after you go free, which means more people who will discover some progress-losing bug in your app - it's good to be able to give them stuff in return.
Edit: I'd also recommend keeping track of the user's category in the save file. So, you might have 'free' users who have never paid anything, 'paid' users who downloaded for free but have bought some IAPs, 'premium' users who bought your app when it was paid, and 'premium+' users who bought your app when it was paid AND have since bought IAPs. Even if you don't need this info immediately, it's worth tracking for analytics and so that you can reward your old premium customers with free content in the future if you decide to do so.

Stop deleting and downloading apps again to gain free access

I want to offer my app free for a period and then charge to continue using it. I understand that the way to do this is to force the user to buy an In-App product after the free period. However, if I simply record the date that the user starts using the app in the standardUserDefaults and use this to calculate when the user must buy the upgrade the user could simply delete the app when the time arrives (I assume the sandbox is also deleted) and download the app again for another free period.
First question. Is my reasoning so far correct?
Second question. Is there any way of accessing the date that an app is first downloaded?
Assuming the answers to these questions are Yes and No I have come up with the following solution.
Upon downloading the app the user is first forced to "buy" free an In-App product which then will have the date it was added to the transaction queue. This In-App product would then be downloaded for any subsequent download and I could use the date of this product as my reference date.
As I can find no reference to this problem or solutions I really wanted confirmation that this was a sound way to proceed or if there was another more standard way of dealing with the problem.
Thank you
Silas
You are not allowed to limit you app for free for a limited period:
11.9 Apps containing content or services that expire after a limited time will be rejected, except for specific approved content (e.g.
films, television programs, music, books)
If you want to risk it, you could save the date (encrypted) in keychain to make it more persistent. Just so you know, user are able to access their keychain data if they iCloud keychain sharing and are on a Mac. So if they delete the correct key or rest there device your app will fall back to the free/trial mode.
This does not seem entirely consistent with:
Communicate the value of your products to your users. Users want to
know exactly what they’re going to buy. Combine information from the
App Store, such as product prices and descriptions, with additional
data from your server or the app bundle, such as images or demos of
your products. Let users interact with a product in a limited way
before buying it. For example, a game that gives the user the option
to buy new race cars can allow users to run a test lap with the new
car. Likewise, a drawing app that lets the user buy additional brushes
can give users the chance to draw with the new brush on a small
scratch pad and see the difference between brushes. This kind of
design provides users an opportunity to experience the product and be
convinced they want to purchase it.
https://developer.apple.com/library/ios/documentation/NetworkingInternet/Conceptual/StoreKitGuide/Chapters/ShowUI.html
One way of letting the user interact with a product feature in a limited way is to let them use it a few times before requiring that they pay to use the feature.

Backing up in app purchases like gold or credits

I have implemented in-app-purchases like Mission packs or "full version" before. However, I am now looking into selling in-game credits.
What are some ways of keeping track of spent and total credits, even after removing and reinstalling the app
Is it common to sync these totals between the different iOS devices of a single user? Or should a user re-buy credits on different devices?
Should I have a user register with my server and track the credit on there?
I strongly recommend you to keep track of user's data on your server.
That way, even if the user deletes the app, the data will still be available after retrieving it from the server. Also, this will make you able to sync the same data between different platforms, not only devices.
After you retrieve the data, you might want to store it in NSUserDefaults and updated when needed.

iOS in-app purchase free / paid persistence

I am building a game that will be free to play, and will include 100 free consumable 'hints'. I intend to offer more hints for purchase through in-app purchase. My current method is to store a file locally with the number of hints the user still has left. When the game is first downloaded the local file doesn't exist, so a new file is created with 100 hints. When an in-app purchase happens, it simply adds to the number of hints. (In the game, each hint simply removes a choice from a multiple choice question - the file simply stores a counter.)
My problem: A user could simply delete the app when they have 0 hints remaining (which will delete my local file that has a count of 0), re-download the app from the app store and they will then start again with 100 hints.
My question: How do I prevent this? Is there a different method I should use for storing hints?
use the Keychain to store your data, because the Keychain items are not deleted even if the app is Uninstalled or removed. This Api will help a lot link, have a look
or
You can refer to Apple's documentation on Keychain data
If you are going to offer some part of your hints as an in-app product, I suggest you to keep track of all your hints (both purchased and free) on a server. This way you can keep track of each user and even if they delete and re-download your app, you will still be able to keep track of your hints.
Edit: If you are implementing IAP you might find it healthy to keep track of your purchased goods anyway (ie. keeping track of your purchase statistics, watching out for fake in-app purchases, etc.)
usualy you use a server for such things, so not the device but the account is the interesting. Also a good possibility to save your progress and share to other devices ;)

Resources