0

I have a Mac OS X application with IAP. The IAP items are consumable and large quantities of them may be used in a very short time, not at once, but in small pieces. So, basically it is not practical for me to save the consumption of these items on my server, because if I do so, my app needs to communicate with the server almost constantly, just to update the consumption of the item in small bits.

I have managed to store this consumable item data on a file locally located in user's app container folder. I also have used some kind of encryption, so that user can't easily add quantities to the item.

My question is: Is this method reliable? My biggest concern is that user make a purchase, and then somehow the data that I have saved locally be destroyed; this lost item can never be retrieved. Does the data in the app's container folder get lost when user uninstalls or updates my app?

On the other hand, I can not save purchases on my server and restore them if user lost the file, because I can never know which quantities of the item have been used by the user since its purchase.

DARKMATTER
  • 361
  • 5
  • 14

1 Answers1

0

You can use the Keychain. It is predefined by Apple secured container with data store/retrival API.

gleb.kudr
  • 1,518
  • 12
  • 16
  • I actually tried Keychain, but since all examples I found were for iOS, I couldn't get it work on Mac: I could store data on Keychain, but then user could easily access it and change it. I knew I was doing something wrong, but I couldn't figure out the problem. So, I gave up using Keychain. – DARKMATTER Oct 13 '13 at 16:50
  • So you can basically implement your own crypto-protection service. There are many libraries to do so. Check this http://stackoverflow.com/questions/1276798/crypto-library-suitable-for-objective-c And you can store the user's data in iCloud. – gleb.kudr Oct 13 '13 at 17:11
  • Yes, I can encrypt data. My main concern is where to store this encrypted data? I don't want this data be lost for example if my app is uninstalled or updated. Will the data stored in container folder or as you suggested iCloud be lost if user uninstalled or updated my app? – DARKMATTER Oct 13 '13 at 19:11
  • The data in iCloud wouldn't be lost in this case. – gleb.kudr Oct 13 '13 at 20:12
  • It's very easy to find the keychain, find the item and copy the password in cleartext itself from in OS X. – Jonny Oct 24 '13 at 08:25
  • Yes, I thought I was doing keychain incorrectly, but my code was correct. The problem is with the keychain which is easily accessible on Mac. I thought only applications which create keychain items can access and modify the item, but unfortunately this is not the case. Users can easily modify or delete items. – DARKMATTER Oct 28 '13 at 01:03
  • iCloud is not reliable either, since users can disable iCloud. – DARKMATTER Oct 28 '13 at 01:04