Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8424245
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T03:56:09+00:00 2026-06-10T03:56:09+00:00

I was wondering how it is possible, to include certain restrictions inside an app,

  • 0

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.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-10T03:56:10+00:00Added an answer on June 10, 2026 at 3:56 am

    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

    #import <Foundation/Foundation.h>
    
    @interface AuthorizeSingleton : NSObject
    @property (strong, nonatomic) NSNumber* premium;
    @end
    

    Here the .m
    #import AuthorizedSingleton.h

    AuthorizeSingleton* _sharedInstance=nil;
    
    @interface AuthorizeSingleton ()
    
    @property (strong, nonatomic) NSDate* timestamp;
    @property (strong, nonatomic) NSNumber* numberOfcomentary;
    @end
    
    @implementation AuthorizeSingleton
    @synthesize timestamp=_timestamp, numberOfcomentary=_numberOfcomentary;
    
    -(id)init{
         if (self == [super init]) {
        //Here you should take data from your persistence(NSUSerDefaults or something like that) Here I initialize at 0
             _timestamp=[[NSDate alloc] init];
             _numberOfcomentary= [NSNumber numberWithInt:0];
        }
    
         return self;
    }
    
    +(AuthorizeSingleton*)sharedInstance{
        if (!_sharedInstance) {
            _sharedInstance = [[AuthorizeSingleton alloc] init];
        }
    
        return _sharedInstance;
    }
    
    -(BOOL)shouldDoComentary{
        NSDate* today= [[NSDate alloc] init];
        NSTimeInterval interval = [_timestamp timeIntervalSinceDate: today];
    
        if (interval>60*60*24) {
            _timestamp=today;
            _numberOfcomentary= [NSNumber numberWithInt:0];
        }
    
        if (_numberOfcomentary.integerValue>5 && !_premium.boolValue) {
            return NO;
        }
    
        return YES;
    }
    
    @end
    

    I don’t test it but that’s the idea. You call the class from where you want an authorization like

    BOOL auth = [[AuthorizedSingleton sharedInstance] shouldDoComentary]
    if(!auth){
        //show error 
    }
    else{
         //do action
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I was wondering if it is possible to include SVG content inside a panel
Just wondering is it possible to build CLI app that can be run from
I am wondering if its possible to have a an (||)or or (&&)and operator
I'm writing a library for C#. I'm wondering if it's possible to only have
I was wondering if it is possible to include inner variables or delegates in
Im wondering if it is possible to use g:include to include only the body
I was wondering if it is possible to hide variables from the include. In
I was wondering if it's possible to include hashes of external files within a
I was wondering if it is possible if I could include a Fix List
I am wondering if it is possible to have the standard url patterns spread

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.