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

  • Home
  • SEARCH
  • 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 7605345
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T00:08:43+00:00 2026-05-31T00:08:43+00:00

Ha-ii ,am doing an in-app purchase in my application,i need to disable a button

  • 0

Ha-ii ,am doing an in-app purchase in my application,i need to disable a button when the in-app content purchase is success,so i put the NSuserdefault to my code to identify weather its success or not,but NSUserDefault works only when i refresh the page,i didnt get the button enabled when the content success message is come ,i get enabled when i go back to another page and came back,my need is to pass instance message to the viewcontroller through notification.my code is

- (void)paymentQueue:(SKPaymentQueue *)queue updatedTransactions:(NSArray *)transactions {
    for(SKPaymentTransaction *transaction in transactions) {
        switch (transaction.transactionState) {

            case SKPaymentTransactionStatePurchasing:
                // Item is still in the process of being purchased
                break;

            case SKPaymentTransactionStatePurchased:
                // Item was successfully purchased!

                // --- UNLOCK FEATURE OR DOWNLOAD CONTENT HERE ---
                // The purchased item ID is accessible via 
                // transaction.payment.productIdentifier

                // After customer has successfully received purchased content,
                // remove the finished transaction from the payment queue.
                [[SKPaymentQueue defaultQueue] finishTransaction: transaction];
                 [[NSUserDefaults standardUserDefaults] setBool:YES forKey:@"Transsucess"];
                break;

            case SKPaymentTransactionStateRestored:
                // Verified that user has already paid for this item.
                // Ideal for restoring item across all devices of this customer.

                // --- UNLOCK FEATURE OR DOWNLOAD CONTENT HERE ---
                // The purchased item ID is accessible via 
                // transaction.payment.productIdentifier

                // After customer has restored purchased content on this device,
                // remove the finished transaction from the payment queue.
                [[SKPaymentQueue defaultQueue] finishTransaction: transaction];
                break;

            case SKPaymentTransactionStateFailed:
                // Purchase was either cancelled by user or an error occurred.

                if (transaction.error.code != SKErrorPaymentCancelled) {
                    // A transaction error occurred, so notify user.
                [[NSUserDefaults standardUserDefaults] setBool:YES forKey:@"Transsucess"];
                }
                // Finished transactions should be removed from the payment queue.
                [[SKPaymentQueue defaultQueue] finishTransaction: 

transaction];
                break;
        }
    }
}

in my anothervierwcontroller i want to pass the Notification value insted of Nsuserdefault value.
How to do this.please help me.

  • 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-31T00:08:44+00:00Added an answer on May 31, 2026 at 12:08 am

    in your first view vieDidLoad add the line ..

    [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(ContentPurchased) name:@"Purchased" object:nil];
    

    ( do remove the observer in dealloc)

    then when you have successful purchase in your question code..
    Post the notification

    [[NSNotificationCenter defaultCenter] postNotificationName:@"Purchased"  object:nil userInfo:nil];
    

    You can pass an object..but i believe you should store the purchase transaction detail in NSUserdefautls..since it will be needed in the next runs of the app..

    When you post the notification ContentPurchased method is called in first view ( you have to add that in the view controller)

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I need to implement inapp purchase for an app and i am doing 1st
Hello Am Currently Doing An App Related To Sound Modulation I need to know
I'm doing a small app in Excel, and I have the following code when
I am doing the In App Purchase Functionality in sample App from this tutorial.
hi i am doing one app here.user click button once means in another activity
I am doing an app based on tabbarController. I have a 3 tabbar items.
We are doing an app to manage and print Word, Excel, PowerPoint, and PDF
I am doing an app that requires authentication. In the index page of the
Im currently doing a console app that has to send scheduled emails. In one
I'm doing an iOS app that crawl my youtube subscription's videos. I have a

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.