我已成功在iPad iOS 5.1沙盒环境中设置应用内购买,但是,它无法在iPhone 4.1上运行。我的iPhone 4.1是jailbrocken。在iPhone上运行时,控制台会在代码中显示消息No product available
,即count =0
:
-(void)productsRequest:(SKProductsRequest *)request didReceiveResponse:(SKProductsResponse *)response{
SKProduct *validProduct=nil;
int count=[response.products count];
if (count>0) {
validProduct=[response.products objectAtIndex:0];
NSLog(@"Product available");
}else if(!validProduct){
NSLog(@"No product available");
}
}
你对此有什么经验吗? “jailbroken”iPhone会导致这个问题吗?
由于
更新
这是我的purchase
功能:
-(void)purchase{
SKMutablePayment *payment = [[[SKMutablePayment alloc] init] autorelease];
payment.productIdentifier =MY_PRODUCT_ID;
payment.quantity = 1;
[[SKPaymentQueue defaultQueue] addPayment:payment];
}