As a beginner whil trying in-app purchase in iOS application I followed the following steps :
- enabled in app purchase in capabilities.
- created provisional profile on developer account and downloaded it.
- created iTunes Connect app submission.
- created in-app purchase products in Features sections of iTunes Connect.
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.");
}
}
- but -(void)productsRequest:(SKProductsRequest *)request didReceiveResponse:(SKProductsResponse *)response implementation is returning invalid products.
Please help me in understanding whats lacking.