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 6780269
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T16:29:11+00:00 2026-05-26T16:29:11+00:00

I just added one in-app purchase to my app. When a user click on

  • 0

I just added one in-app purchase to my app.
When a user click on the “purchase” button and the transaction ends, the “purchase” button is replaced by another button to access to the new features.
But everytime I come back to that page or I close and open again the app, there is again the “purchase” button.
How can I do to have always the new button if the user has purchased the new contents?
Here is my code:

-(void)paymentQueue:(SKPaymentQueue *)queue updatedTransactions:(NSArray *)transactions {

    for (SKPaymentTransaction *transaction in transactions) {

          switch (transaction.transactionState) {

               case SKPaymentTransactionStatePurchasing:

                    break;

               case SKPaymentTransactionStatePurchased:

               [[SKPaymentQueue defaultQueue] finishTransaction:transaction];

                           UIButton *button = [UIButton buttonWithType:UIButtonTypeCustom];

                              [button addTarget:self 

                               action:@selector(myaction)

                               forControlEvents:UIControlEventTouchUpInside];

                    [button setTitle:@"mytitle" forState:UIControlStateNormal];



                    button.frame = CGRectMake(156.0, 248.0, 129.0, 36.0);

                    [self.view addSubview:button];

                    break;

               case SKPaymentTransactionStateRestored:

                    [[SKPaymentQueue defaultQueue] finishTransaction:transaction];
                         break;

               case SKPaymentTransactionStateFailed:

                    if (transaction.error.code != SKErrorPaymentCancelled) {

                         NSLog(@"Errorr");

                    }

                    [[SKPaymentQueue defaultQueue] finishTransaction:transaction];


          }

     }

}
  • 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-05-26T16:29:11+00:00Added an answer on May 26, 2026 at 4:29 pm

    You should save somewhere information about the fact that user has purchased the content.

    There are a lot of ways to do that. For example, you could use NSUserDefaults:

    NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
    int version = [defaults integerForKey:@"db_version"];                 // <- read int value from defaults
    [defaults setValue:[NSNumber numberWithInt:2] forKey:@"db_version"];  // <- set int value
    [defaults synchronize];    // <- save changes
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm code reviewing a change one of my co-workers just did, and he added
I just added adds to my app, but the moment i run it i
I have just added an ADBannerview in my App. I create the AdBannerView in
I've recently just added Devise to my first Rails3 app, and I'm having a
i have implemented the in app purchase in my application and added few in
Good day. I've added an In-App Purchase non-consumable product to my existing app for
I've just added video uploading with paperclip to a Rails 3 app I have
I've just added the required code to my Android app and released the update
I just integrated the Apple's In-App purchase into my application with 4 products. It
I am working a project with multiple UIViewController s. I just added a new

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.