开发者

iPhone : In-App purchase query

I want to add In-App purchase functionallity in my app.

My app contains many feature. In the free version, Some features of 开发者_StackOverflow中文版my app will be accessible and some features are disabled.

What i want to do is, i want to enable all the feature once the user pays for full version of my app.

How do I store flags in iOS keychain ?

How can I do this ?

Is there any examples or good links ?


There are many ways you could achieve this:

  • Using your own server and delivering the content once the app is purchased succesfully.
  • Using the iOS keychain to store some flags.

I will talk about the second point here. I will assume you can't get your own server.

The easiest way to do is to code in "disabled" features into your app, as you normally would. But store a flag a somewhere, say, a flag called "contentHasBeenPurchased". You could store this flag anywhere; in a plist, in NSUserDefaults, but these are insecure ways to store your flag because a jailbroken app could easily access your application's sandbox. These methods are secure with non-jailbroken users, for the most part... There is software that allows you to access the iOS filesystem and edit plists from there. So yeah, storing this specific flag in a plist or NSUserDefaults is certainly not a good idea.

So you are left in storing this flag "contentHasBeenPurchased" in the iOS keychain, because it is encrypted. If you don't know how to use the iOS keychain, it's a bit complex to learn, but it will certainly pay off in the near future. After you have your flag in the keychain, it's just matter of checking whether its value is true or false to enable the purchased content. When the user purchases the app, just set the flag to true, and you are ready to go.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜