How would I save “coins” in my game in Swift SpriteKit?

前端 未结 2 1464
伪装坚强ぢ
伪装坚强ぢ 2021-01-23 16:39

I have this game where the user collects coins and I want them to be able to save them and use the coins for in app purchaces. How would I do this? Could I use NSUserDefaults fo

2条回答
  •  醉话见心
    2021-01-23 16:45

    yes, you have different options to save data : nsuserdefaults, write to a file and store the file, coredata, or use a webserver with a database.

    If someone knows how to hack your app, he will use what is inside your app (the 3 first methods), this is why many big games use internet (webserver) to check against what was bought by the user.

    But, it is not so often that someone hack your game, if he does though, he would never pay anyway. So stay with nsuserdefaults, it is simple and good enough in my opinion.

提交回复
热议问题