As a beginner whil trying in-app purchase in iOS application I followed the following steps :
created the same array of product identifiers. Also implemented required delegates in view controller class.
#import <UIKit/UIKit.h>
#import <StoreKit/StoreKit.h>
@interface ViewController :UIViewController<SKProductsRequestDelegate,SKPaymentTransactionObserver,SKRequestDelegate>
in viewdidload()
productIds = [NSArray arrayWithObjects:@"pro1",@"pro2", nil];
also,
-(void)viewWillAppear:(BOOL)animated
{
if([SKPaymentQueue canMakePayments]){
SKProductsRequest *requestPro = [[SKProductsRequest alloc]initWithProductIdentifiers:[NSSet setWithArray:productIds]];
requestPro.delegate = self;
[requestPro start];
}
else{
NSLog(@"Cannot perform In App Purchases.");
}
}
Please help me in understanding whats lacking.
You need to test most in app purchase related functions on a real device. They don't work on the simulator!