我正在 iOS sdk 中的 inapp-purchase 中工作,我已完成所有步骤,例如在 iTunes 中创建应用程序和在 iTunes connect 上的 manage-inapppurchase 中创建非消耗性应用程序。我的应用程序状态为等待上传,如下面的屏幕截图:
我的未购买状态已准备好提交
代码明智的应用程序购买功能已完成,但是,我测试我的应用程序是SKProductsRequest返回未找到产品...!
我的主要应用程序包 id 像com.mycompany.myapp,
和我的应用内捆绑 ID,如com.mycompany.paidapp。
他们如何测试应用内购买步骤,任何人都可以指导我,请..!
我的示例代码在这里:
- (void)loadStore {
if ([SKPaymentQueue canMakePayments]) {
NSLog(@"Parental-controls are disabled");
request = [[SKProductsRequest alloc] initWithProductIdentifiers:[NSSet setWithObject:@"com.mycompany.paidapp"]];
//request.delegate = self;
[request setDelegate:self];
[request start];
}
else {
NSLog(@"Parental-controls are enabled");
}
}
- (void)productsRequest:(SKProductsRequest *)request didReceiveResponse:(SKProductsResponse *)response {
SKProduct *validProduct = nil;
int count = [response.products count];
if (count > 0)
{
validProduct = [response.products objectAtIndex:0];
NSLog(@"Products found!");
[[NSNotificationCenter defaultCenter] postNotificationName:kProductsLoadedNotification object:@"Product Found..!"];
} else if (!validProduct)
{
NSLog(@"No products available");
[[NSNotificationCenter defaultCenter] postNotificationName:kProductsLoadedNotification object:@"Product Not Found..!"];
}
}
命令提示符总是在输出下方返回 nslog:
No products available