can't find IAP in productrequest

| | August 8, 2015

I create IAP in itune connect (non-consumable) to access view controller but I test in iPhone it not pop up to purchase page

my IAP product ID is “Egayov”

my app id is “my.com.th.myapp”

this is my code

- (void)viewDidLoad {
[super viewDidLoad];
if([SKPaymentQueue canMakePayments]){
    NSLog(@"can buy all IAP");
    SKProductsRequest *productRequest = [[SKProductsRequest alloc]initWithProductIdentifiers:[NSSet setWithObject:@"my.com.th.myapp"]];
    productRequest.delegate = self;
    [productRequest start];
}
else{
    NSLog(@"Parental controll on");
}
}

-(IBAction)Buyvoyage{
SKPayment *vo = [SKPayment paymentWithProductIdentifier:@"my.com.th.myapp"];
        [[SKPaymentQueue defaultQueue] addTransactionObserver:self];
        [[SKPaymentQueue defaultQueue] addPayment:vo];
}

- (void)productsRequest:(SKProductsRequest *)request didReceiveResponse:(SKProductsResponse *)response
{

SKProduct *vaildproduct = nil;
int count = [response.products count];
if (count>0) {
    vaildproduct = [response.products objectAtIndex:0];
}
 if (!vaildproduct){
    NSLog(@"no iap  %@",vaildproduct);
}

}
-(void)paymentQueue:(SKPaymentQueue *)queue removedTransactions:(NSArray *)transactions{
    for (SKPaymentTransaction *transaction in transactions) {
    switch (transaction.transactionState) {
        case SKPaymentTransactionStatePurchasing:
            break;
        case SKPaymentTransactionStatePurchased:
            [self checkiap];
            break;
        case SKPaymentTransactionStateRestored:
            [[SKPaymentQueue defaultQueue]finishTransaction:transaction];
            break;
        case SKPaymentTransactionStateFailed:
            if (transaction.error.code != SKErrorPaymentCancelled) {
                NSLog(@"Payment Failed");
            }
            [[SKPaymentQueue defaultQueue]finishTransaction:transaction];
            break;
    }
}
}

in productrequest function it go to else condition

One Response to “can't find IAP in productrequest”

  1. I had the same problem and honestly saying it wasn’t solved. It’s much easier to implement IAPs with Parse. It takes just few lines of code and it really works. Read this, I’m sure it will help you:
    http://blog.parse.com/announcements/in-app-purchase/

Leave a Reply