0

I have an app using in app purchase to buy diamonds. And to buy diamonds I want to use in app purchase. Paid Apps agreement activated. I already defined product_id from API.

-(void)applePay:(NSDictionary *)dic{

    [self.delegate applePayShowHUD];
    NSDictionary *dics = @{
                          @"uid":[Config getOwnID],
                          @"coin":[dic valueForKey:@"coin_ios"],
                          @"money":[dic valueForKey:@"money"],
                          @"changeid":dic[@"id"]
                          };
    [YBToolClass postNetworkWithUrl:@"Charge.getIosOrder" andParameter:dics success:^(int code, id  _Nonnull info, NSString * _Nonnull msg) {
        if (code == 0) {
            NSString *infos = [[info firstObject] valueForKey:@"orderid"];
            self.OrderNo = infos;//订单
            //苹果支付ID
            NSString *setStr = [NSString stringWithFormat:@"%@_testing",[dic valueForKey:@"product_id"]];
            NSSet *set = [[NSSet alloc] initWithObjects:setStr, nil];
            self.request = [[SKProductsRequest alloc] initWithProductIdentifiers:set];
            self.request.delegate = self;
            [self.request start];
            
        }
        else{
            [self.delegate applePayHUD];
            dispatch_async(dispatch_get_main_queue(), ^{

                [MBProgressHUD showError:msg];
            });
        }

    } fail:^{
        
    }];
}

- (void)productsRequest:(SKProductsRequest *)request didReceiveResponse:(SKProductsResponse *)response
{
   
    [self.delegate applePayHUD];
    
    self.products = response.products;
    self.request = nil;
    for (SKProduct *product in response.products) {
        NSLog(@"已获取到产品信息 %@,%@,%@",product.localizedTitle,product.localizedDescription,product.price);
        self.product = product;
    }
    if (!self.product) {
        dispatch_async(dispatch_get_main_queue(), ^{
            [self showAlertView:YZMsg(@"无法获取商品信息")];
        });
        
        return;
    }
    //3.获取到产品信息,加入支付队列
    SKPayment *payment = [SKPayment paymentWithProduct:self.product];
    [[SKPaymentQueue defaultQueue] addTransactionObserver:self];
    [[SKPaymentQueue defaultQueue] addPayment:payment];
}

and I already put the product in app store connect like this:

enter image description here

I put configuration too inn Xcode:

enter image description here

this is for the scheme:

enter image description here

I always get skipping product, am I missing something here ?

koen
  • 5,383
  • 7
  • 50
  • 89

0 Answers0