In App purchase - hide button when complete

Discussion in 'iOS Programming' started by ppn, Apr 4, 2011.

  1. ppn, Apr 4, 2011
    Last edited: Apr 4, 2011

    ppn
    macrumors member

    Joined:
    Oct 31, 2010
    #1
    I'm implementing an in app purchase and everything works fine in the sandbox environment but I can't seem to hide the "upgrade" button once the purchase is complete. I have a bool value to store whether the app has been purchased but after the purchase, I need to go to another view and come back before the upgrade button is hidden.

    Any suggestions? I've followed the example in this website for the in app purchase template. Is there a way to send a notification to my main view and request it to hide the button?

    Code:
    - (IBAction)upgrade:(id)sender{
        InAppPurchase *inAppPurchase = [[InAppPurchase alloc] init];
        [inAppPurchase requestProUpgradeProductData];
        [inAppPurchase purchaseProUpgrade];
        if ([[NSUserDefaults standardUserDefaults] boolForKey:kupgradePurchased] == YES) {
            upgrade.hidden = YES;
        }
    }
     

Share This Page