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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T10:05:12+00:00 2026-05-31T10:05:12+00:00

I’m having a weird problem with an in-app purchase… After I’m requesting the product

  • 0

I’m having a weird problem with an in-app purchase…

After I’m requesting the product information, sometimes the paymentQueue:updatedTransactions gets called automatically for some reason.

In my store’s viewDidLoad method, I initialize and start the request:

- (void)viewDidLoad
{
    [super viewDidLoad];

    productsArray = [[NSArray alloc] init];

    [[SKPaymentQueue defaultQueue] addTransactionObserver:self];

    NSSet *productIdentifiers = [NSSet setWithObjects:PRODUCT_ID, nil];
    productsRequest = [[SKProductsRequest alloc] initWithProductIdentifiers:productIdentifiers];
    productsRequest.delegate = self;
    [productsRequest start];
}

Then I get a response:

- (void)productsRequest:(SKProductsRequest *)request didReceiveResponse:(SKProductsResponse *)response
{
    productsArray = [[NSArray alloc] initWithArray:response.products];

    NSLog(@"Products Count: %d",[productsArray count]);
    NSLog(@"Invalid Products Count: %d",[response.invalidProductIdentifiers count]);

    if ([productsArray count] > 0)
    {
        NSLog(@"Product title: %@" ,[productsArray objectAtIndex:0]);
        [self hideLoadingView];


    } else {
        UIAlertView* alertView = [[UIAlertView alloc] initWithTitle:@"No products found"
                                                            message:@"There might have been a problem. Please try again soon." delegate:self 
                                                  cancelButtonTitle:@"OK" otherButtonTitles:nil];
        [alertView show];
        [alertView release];

        [self hideLoadingView];
        [purchaseBtn setEnabled:NO];

    }

    [productsRequest release];

    [[NSNotificationCenter defaultCenter] postNotificationName:kInAppPurchaseManagerProductsFetchedNotification object:self userInfo:nil];

}

This is where I expect the process to end, and wait for the user to tap the buy button… but sometimes (like, 70% of the times), I get a username/password alert box pop-up in order to buy the item… but the user didn’t tap anything… (and if the user is already “logged in”, then it buys the item without asking. Which is NOT how it should be.

This is the method that is being called automatically sometimes:

- (void)paymentQueue:(SKPaymentQueue *)queue updatedTransactions:(NSArray *)transactions
{
    NSLog(@"updated transaction");
    for (SKPaymentTransaction *transaction in transactions)
    {
        switch (transaction.transactionState)
        {
            case SKPaymentTransactionStatePurchased:
                NSLog(@"transationStatePurchased");
                [self completeTransaction:transaction];
                break;
            case SKPaymentTransactionStateFailed:
                NSLog(@"transationStateFailed");
                [self failedTransaction:transaction];
                break;
            default:
                break;
        }
    }
}

and this is the IBAction of the buy button:

-(IBAction)buyItem:(id)sender {

    [self showLoadingView];

    SKPayment *payment = [SKPayment paymentWithProductIdentifier:[(SKProduct *)[productsArray objectAtIndex:0] productIdentifier]];
    [[SKPaymentQueue defaultQueue] addPayment:payment];

    }        
}

I thought that the user/password alert box of StoreKit shouldn’t get displayed until I call the defaultQueue’s “addPayment” method, which appears ONLY in the IBAction.

Any ideas?
Thanks!

  • 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-31T10:05:13+00:00Added an answer on May 31, 2026 at 10:05 am

    Once you add a transaction observer iOS will check the default Queue if there is any non completed transaction (which mean you didn’t finish it) so it will show the alert box every time there is a transaction until you finish it even if you didn’t do any action to add a new payment.

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

Sidebar

Related Questions

link Im having trouble converting the html entites into html characters, (&# 8217;) i
We're building an app, our first using Rails 3, and we're having to build
For some reason, after submitting a string like this Jack’s Spindle from a text
I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this
I am currently running into a problem where an element is coming back from
I'm having trouble keeping the paragraph square between the quote marks. In firefox the
I'm trying to use string.replace('’','') to replace the dreaded weird single-quote character: ’ (aka
I am writing an app with both english and french support. The app requests
I am using Paperclip to handle profile photo uploads in my app. They upload

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.