I was wondering how it is possible, to include certain restrictions inside an app, when the user loaded the free version of it.
For example: I have a tableView with around 100 entries. The user can favorite 10 of those, but not more, unless the user buys the premium version! I was thinking of just putting “return 10” in the numberOfRowsInSection on the FavoritetableViewController. Or is there a better/comfortabler way to do this?
There is also a commentary function. So if the user sees a comment, he/she wants to reply to, he/she only has to click on “answer”. But for free users I wanna limit that interaction by 5.
So they can write 5 comments a day. I was playing with the thought of implementing some sort of internal clock. And everytime the user clicks on “Submit” a counter goes up. And when the counter reaches 5, the button gets disabled. And after the clock has past 24 hours this count gets resetted. But to be honest I don’t know how to do that yet.
So any idea or input would be greatly appreciated.
I don’t know if it’s the best solution and if will help you. For me the way to do that is have a singleton class. You should initialize him at the app launching with a Bool var premium. At this moment you should initialize the class with all the data you need: number of favorite lines, comments the last day, ….
Before every “premium operation”, you should acces to a method like:
BOOL authorized = [[AuthorizeSingleton sharedmanager] operation]. Here you will have all the test needed to know if he can perform the premium action.You should acces to this singleton from a viewController every time someones wants to do a premium action. If the return is NO you pop a error message, in the other case you do the action.
If the user is premium always return yes.
Coded quickly something like that
Here the .h
Here the .m
#import AuthorizedSingleton.h
I don’t test it but that’s the idea. You call the class from where you want an authorization like