我在執行這個代碼:在應用程序內購買 - SKProduct請求失敗,
if ([SKPaymentQueue canMakePayments])
{
// Display a store to the user.
NSLog(@"Device Can Make Payments");
SKProductsRequest *ProductRequst = [[SKProductsRequest alloc]initWithProductIdentifiers:[NSSet setWithObjects:@"slalomtfcoins", nil]];
ProductRequst.delegate = self;
[ProductRequst start];
}
else {
// Warn the user that purchases are disabled.
NSLog(@"Device Can't Make Payments");
UIAlertView *thealert = [[UIAlertView alloc]initWithTitle:@"Your Device Limited" message:@"we have noticed that you device restrictions setting are currently limited. you can change it ny going to Settings -> General -> Restrictions and turn it off" delegate:nil cancelButtonTitle:@"OK" otherButtonTitles:nil, nil];
[thealert show];
[thealert release];
}
-(void)productsRequest:(SKProductsRequest *)request didReceiveResponse:(SKProductsResponse *)response{
SKProduct *VailProduct = nil;
NSLog(@"%d",[response.products count]);
int count = [response.products count];
if (count>0) {
VailProduct = [response.products objectAtIndex:0];
NSLog(@"Products are availble");
} else if (!VailProduct){
NSLog(@"Products are Not availble");
}
}
和日誌打印 「產品不是availble的」。 我的p.list中的包ID是正確的 ,產品ID與itunes連接相同。
是什麼問題?
感謝
如果你有隻是在iTunes連接中創建產品,有時需要一段時間(幾個小時或更長時間)才能測試它們。 – 2012-03-13 18:45:02