In-App Upgrade With MBStoreCheck

What a great day for iOS developers. In addition to some new APIs, Apple has dropped an unexpected “one more thing” at the end of the keynote – Swift. Swift is basically a new programming language for iOS and OS X. After playing with it for a couple of hours today, I love it. Granted, it will take some learning before I can really understand what’s going on, but so far, it’s pretty cool.

Recently I had the privilege to work with my friends on a project that required in-app purchase integration. To be more precise, we had a couple of app features locked and required paid upgrade to work. Because of that, I had to dive into in-app purchase APIs. Sadly, most of the articles – tutorials, are too complex for such a simple┬átask. Thats why I wrote a very simple library implementing in-app purchase with 2 lines of code.

MBStoreCheck assumes you want to unlock already included feature. I am not going to walk through the setup of IAP IDs with Apple. But before I dive into it, I would like to mention that MBStoreCheck is written from a perspective of “authorized”… as in “is user authorized to use this feature”?

First thing you want to do is to make sure the user upgraded to the paid version of your app by calling the following method:

If the above method return YES, go ahead and enable your paid feature, if NO, proceed with the following method call:

This method will star a chain reaction to guide your users through the in-app purchase. Just make sure you setup your product identifier in the header file to silence the compiler warning.

You can find MBStoreCheck on my GitHub page here.

In-App Upgrade With MBStoreCheck

Leave a Reply

Your email address will not be published. Required fields are marked *