我在测试应用内购买功能时遇到问题。如果我将应用程序重新安装到已经安装了以前版本的应用程序的设备上,则skproductsrequest只返回invalidproductidentifiers上的对象的响应。如果我从设备中删除应用程序,然后再次安装新版本,则skproductsrequest可以正常工作。
有什么想法吗?
提前谢谢。
- (void)requestProductData:(NSString *)aFeatureID {
SLLog(@"Products Request For: %@", aFeatureID);
SKProductsRequest *request = [[SKProductsRequest alloc] initWithProductIdentifiers:[NSSet setWithObject:aFeatureID]];
request.delegate = self;
[request start];
}
- (void)productsRequest:(SKProductsRequest *)request didReceiveResponse:(SKProductsResponse *)response
{
if ([response.products count] > 0) {
[self.purchasableObjects addObjectsFromArray:response.products];
#ifndef NDEBUG
for(int i=0;i<[self.purchasableObjects count];i++)
{
SKProduct *product = [self.purchasableObjects objectAtIndex:i];
SLLog(@"Feature: %@, Cost: %f, ID: %@",[product localizedTitle],
[[product price] doubleValue], [product productIdentifier]);
}
for(NSString *invalidProduct in response.invalidProductIdentifiers)
SLLog(@"Problem in iTunes connect configuration for product: %@", invalidProduct);
#endif
isProductsAvailable = YES;
} else if ([response.invalidProductIdentifiers count] > 0){
SLLog(@"MKStoreManager-productsRequest empty results: %@", [response.invalidProductIdentifiers objectAtIndex:0]);
}
if([_delegate respondsToSelector:@selector(productFetchComplete)])
[_delegate productFetchComplete];
[request autorelease];
}
最佳答案
有人在cocoa-dev@lists.apple.com告诉我:
你在连接沙箱吗
环境还是生产?
我相信你只能连接到
通过xcode和
如果应用程序正在从
应用商店版本,不会触发
沙箱。至少,那是一个很小的
我亲眼目睹的一点IAP巫毒…
这意味着它可能不再是真的
任何时候,因为IAP设置是一个
舍身羔羊
魔法。
我不能百分之百确定,因为我还没有测试,但我会尽快告诉你。