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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T16:02:52+00:00 2026-05-30T16:02:52+00:00

I have an iPhone app on the market that has three different in app

  • 0

I have an iPhone app on the market that has three different in app purchases on it. The problem is, when a user purchases a feature, they generally get prompted for their password more than once. Is this normal? Is it something with Apple or with my code?

Here is an example of one of the purchases:

        InAppPurchaseManager *manager = [[InAppPurchaseManager alloc] init];

    [manager loadStore];

    if([manager canMakePurchases]){
        [manager purchaseFeature:@"com.myfeature1"];

        VehicleExpensesController *aViewController = [[VehicleExpensesController alloc]
                                                      initWithNibName:@"VehicleExpensesController" bundle:nil];
        [self presentModalViewController:aViewController animated:YES];
        [aViewController release], aViewController = nil;

    }

and here is my InAppPurchaseManager.m file:

#import "InAppPurchaseManager.h"
@implementation InAppPurchaseManager


- (void)requestProUpgradeProductData
{
     NSSet *productIdentifiers = [NSSet setWithObjects:@"com.myfeature1", @"com.myfeature2", @"com.myfeature3", nil ];
productsRequest = [[SKProductsRequest alloc] initWithProductIdentifiers:productIdentifiers];
productsRequest.delegate = self;
[productsRequest start];

// we will release the request object in the delegate callback
}

#pragma mark -
#pragma mark SKProductsRequestDelegate methods

- (void)productsRequest:(SKProductsRequest *)request didReceiveResponse:(SKProductsResponse *)response
{
NSArray *products = response.products;
proUpgradeProduct = [products count] == 1 ? [[products firstObject] retain] : nil;

if (proUpgradeProduct)
{
    NSLog(@"Product title: %@" , proUpgradeProduct.localizedTitle);
    NSLog(@"Product description: %@" , proUpgradeProduct.localizedDescription);
    NSLog(@"Product price: %@" , proUpgradeProduct.price);
    NSLog(@"Product id: %@" , proUpgradeProduct.productIdentifier);
}

for (NSString *invalidProductId in response.invalidProductIdentifiers)
{
    NSLog(@"Invalid product id: %@" , invalidProductId);
}

// finally release the reqest we alloc/init’ed in requestProUpgradeProductData
[productsRequest release];

[[NSNotificationCenter defaultCenter] postNotificationName:kInAppPurchaseManagerProductsFetchedNotification object:self userInfo:nil];
}
#pragma -
#pragma Public methods

//
// call this method once on startup
//
- (void)loadStore
{
    // restarts any purchases if they were interrupted last time the app was open
    [[SKPaymentQueue defaultQueue] addTransactionObserver:self];

    // get the product description (defined in early sections)
    [self requestProUpgradeProductData];
}

// call this before making a purchase
//
- (BOOL)canMakePurchases
{
    return [SKPaymentQueue canMakePayments];
}

// 
// kick off the upgrade transaction
//
- (void)purchaseFeature:(NSString *) identifier
{
SKPayment *payment = [SKPayment paymentWithProductIdentifier:identifier];
[[SKPaymentQueue defaultQueue] addPayment:payment];

}

//
 // saves a record of the transaction by storing the receipt to disk
//
- (void)recordTransaction:(SKPaymentTransaction *)transaction
{
[[SKPaymentQueue defaultQueue] restoreCompletedTransactions];

if ([transaction.payment.productIdentifier isEqualToString:@"com.myfeature1"])
{
    // save the transaction receipt to disk
    [[NSUserDefaults standardUserDefaults] setValue:transaction.transactionReceipt forKey:@"DiscountCalculator" ];
    [[NSUserDefaults standardUserDefaults] synchronize];
} 
if ([transaction.payment.productIdentifier isEqualToString:@"com.myfeature2"])
{
    // save the transaction receipt to disk
    [[NSUserDefaults standardUserDefaults] setValue:transaction.transactionReceipt forKey:@"VehicleExpenses" ];
    [[NSUserDefaults standardUserDefaults] synchronize];
}
if ([transaction.payment.productIdentifier isEqualToString:@"com.myfeature3"])
{
    // save the transaction receipt to disk
    [[NSUserDefaults standardUserDefaults] setValue:transaction.transactionReceipt forKey:@"NoAds" ];
    [[NSUserDefaults standardUserDefaults] synchronize];
}
}

//
// enable pro features
//
- (void)provideContent:(NSString *)productId
{
if ([productId isEqualToString:@"com.myfeature1"])
{
    // enable the pro features
    [[NSUserDefaults standardUserDefaults] setBool:YES forKey:@"DiscountCalculatorIsPurchased" ];
    [[NSUserDefaults standardUserDefaults] synchronize];
}else if ([productId isEqualToString:@"com.myfeature2"])
{
    // enable the pro features
    [[NSUserDefaults standardUserDefaults] setBool:YES forKey:@"VehicleExpensesIsPurchased" ];
    [[NSUserDefaults standardUserDefaults] synchronize];
}else if ([productId isEqualToString:@"com.myfeature3"])
{
    // enable the pro features
    [[NSUserDefaults standardUserDefaults] setBool:YES forKey:@"NoAdsIsPurchased" ];
    [[NSUserDefaults standardUserDefaults] synchronize];
}
}

//
// removes the transaction from the queue and posts a notification with the transaction result
//
- (void)finishTransaction:(SKPaymentTransaction *)transaction wasSuccessful:(BOOL)wasSuccessful
{
// remove the transaction from the payment queue.
[[SKPaymentQueue defaultQueue] finishTransaction:transaction];

NSDictionary *userInfo = [NSDictionary dictionaryWithObjectsAndKeys:transaction, @"transaction" , nil];
if (wasSuccessful)
{
    // send out a notification that we’ve finished the transaction
    [[NSNotificationCenter defaultCenter] postNotificationName:kInAppPurchaseManagerTransactionSucceededNotification object:self userInfo:userInfo];
}
else
{
    // send out a notification for the failed transaction
    [[NSNotificationCenter defaultCenter] postNotificationName:kInAppPurchaseManagerTransactionFailedNotification object:self userInfo:userInfo];
}
}

//
// called when the transaction was successful
//
- (void)completeTransaction:(SKPaymentTransaction *)transaction
{
[self recordTransaction:transaction];
[self provideContent:transaction.payment.productIdentifier];
[self finishTransaction:transaction wasSuccessful:YES];
}

//
// called when a transaction has been restored and and successfully completed
//
- (void)restoreTransaction:(SKPaymentTransaction *)transaction
{
[self recordTransaction:transaction.originalTransaction];
[self provideContent:transaction.originalTransaction.payment.productIdentifier];
[self finishTransaction:transaction wasSuccessful:YES];
}

//
// called when a transaction has failed
//
- (void)failedTransaction:(SKPaymentTransaction *)transaction
{
if (transaction.error.code != SKErrorPaymentCancelled)
{
    // error!
    [self finishTransaction:transaction wasSuccessful:NO];
}
else
{
    // this is fine, the user just cancelled, so don’t notify
    [[SKPaymentQueue defaultQueue] finishTransaction:transaction];
}
}

#pragma mark -
#pragma mark SKPaymentTransactionObserver methods

//
// called when the transaction status is updated
//
- (void)paymentQueue:(SKPaymentQueue *)queue updatedTransactions:(NSArray *)transactions
{
for (SKPaymentTransaction *transaction in transactions)
{
    switch (transaction.transactionState)
    {
        case SKPaymentTransactionStatePurchased:
            [self completeTransaction:transaction];
            break;
        case SKPaymentTransactionStateFailed:
            [self failedTransaction:transaction];
            break;
        case SKPaymentTransactionStateRestored:
            [self restoreTransaction:transaction];
            break;
        default:
            break;
    }
}
}
@end

Sorry if its a lot code – I just wanted to make sure all the relevant code got in there.

  • 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-30T16:02:54+00:00Added an answer on May 30, 2026 at 4:02 pm

    You are calling
    [[SKPaymentQueue defaultQueue] restoreCompletedTransactions];
    inside - (void)recordTransaction:(SKPaymentTransaction *)transaction. This is what requests the password for the second time. You don’t need to call restoreCompletedTransactions to store the details of a transaction.

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

Sidebar

Related Questions

I have an iPhone app that I am writing and it has 2 targets
I have this iPhone app that has an array containing around 50 to 100
I have a iPhone app that has a queue of pictures to upload to
I have an iPhone app that I've built for the app store. Before I
I have an iPhone app that allows users to record videos and I'd like
I have an iphone app i want that befor moving to next screen it
I have an iPhone app running in the simulator that won't quit. I also
I have an iPhone app that heavily relies on the OpenCV library; as such,
I have an iPhone app that is based on a navigation controller. I have
We have an iTrading iPhone app where we allow people to trade on different

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.