1

我正在尝试在我的应用中实现应用内购买。类型为非消耗品。产品请求返回正常......带有正确的标题、描述和价格。但是当我点击购买时,当我点击确认时打开alertView说“确认......环境:沙盒”,应该出现要求用户测试密码的苹果框......但它没有出现并且交易失败没有消息错误...我的应用程序尚未在 AppStore 中,并且 Itunes Connect 中的 In App Purchase Product 的状态为 Ready to Submit正确吗?

这是我的代码:(对不起,代码较长,但我的意思是它对我的问题相关且重要)

 - (void)productsRequest:(SKProductsRequest *)request didReceiveResponse:(SKProductsResponse *)response
 {
NSArray *products = response.products;
proUpgradeProduct = [products count] == 1 ? [[products firstObject] retain] : nil;
if (proUpgradeProduct)
{
    NSLog(@"Product title: %@" , proUpgradeProduct.localizedTitle);
    NSLog(@"Product description: %@" , proUpgradeProduct.localizedDescription);
    NSLog(@"Product price: %@" , proUpgradeProduct.price);
    NSLog(@"Product id: %@" , proUpgradeProduct.productIdentifier);

    //        lblTitulo.text = proUpgradeProduct.productIdentifier;
    //        lblDescricao.text = proUpgradeProduct.localizedDescription;

}

for (NSString *invalidProductId in response.invalidProductIdentifiers)
{
    NSLog(@"Invalid product id: %@" , invalidProductId);
}

// finally release the reqest we alloc/init’ed in requestProUpgradeProductData
[productsRequest release];

[[NSNotificationCenter defaultCenter] postNotificationName:kInAppPurchaseManagerProductsFetchedNotification object:self userInfo:nil];
}
- (void)requestProUpgradeProductData
{
NSSet *productIdentifiers = [NSSet setWithObject:@"versaopro" ];
productsRequest = [[SKProductsRequest alloc] initWithProductIdentifiers:productIdentifiers];
productsRequest.delegate = self;
[productsRequest start];

// we will release the request object in the delegate callback
 }
 - (void)loadStore
{
// restarts any purchases if they were interrupted last time the app was open
[[SKPaymentQueue defaultQueue] addTransactionObserver:self];

// get the product description (defined in early sections)
[self requestProUpgradeProductData];
}

    - (void)purchaseProUpgrade
 {
SKPayment *payment = [SKPayment paymentWithProduct:proUpgradeProduct];
[[SKPaymentQueue defaultQueue] addPayment:payment];
   }



-(IBAction) buyClick: (id) sender {
[self purchaseProUpgrade];
  }
4

0 回答 0