Advertise Mobile SDKs Books Events Forum News Social Networking Support Us
Follow @iphonedevsdk on Twitter

Interface 2, Advanced iOS
Mockup & Code Gen
($9.99)

Make your own iPhone apps
and run them live!
(free)

Pic Frame Dynamo: Photo Editing
($0.99)

Abiliator
($1.99)

Want your application or service advertised on iPhone Dev SDK?

Go Back   iPhone Dev SDK Forum > iPhone SDK Development Forums > iPhone SDK Development

Reply
 
LinkBack Thread Tools Display Modes
Old 11-06-2011, 01:03 PM   #1 (permalink)
Registered Member
 
Join Date: Nov 2011
Posts: 2
SkyWalkerDev is on a distinguished road
Default In app purchase SKPaymentTransactionStatePurchased

Hello everyone, I'n an italian developer, so excuse me for my English.
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:

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];

				
		}

	}

}
SkyWalkerDev is offline   Reply With Quote
Reply

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



» Advertisements
» Online Users: 406
17 members and 389 guests
7twenty7, Alex-alex, Apptronics RBC, baja_yu, dre, gwelmarten, ipodphone, jeroenkeij, jleannex55, matador1978, mbadegree, n00b, pbart, reficul, Retouchable, Sami Gh, usernametaken
Most users ever online was 1,387, 04-10-2012 at 04:21 AM.
» Stats
Members: 175,676
Threads: 94,125
Posts: 402,910
Top Poster: BrianSlick (7,990)
Welcome to our newest member, jleannex55
Powered by vBadvanced CMPS v3.1.0

All times are GMT -5. The time now is 06:22 AM.
Powered by vBulletin® Version 3.8.0
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.3.0