0
votes

As a beginner whil trying in-app purchase in iOS application I followed the following steps :

  1. enabled in app purchase in capabilities.
  2. created provisional profile on developer account and downloaded it.
  3. created iTunes Connect app submission.
  4. created in-app purchase products in Features sections of iTunes Connect.itunes screenshot
  5. 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.");
    }
    }
  1. but -(void)productsRequest:(SKProductsRequest *)request didReceiveResponse:(SKProductsResponse *)response implementation is returning invalid products.

Please help me in understanding whats lacking.

1

1 Answers

0
votes

You need to test most in app purchase related functions on a real device. They don't work on the simulator!