1
給大家嘔吐!幫助... didReceiveResponse不叫
在這裏,我仍然發現實施storekit框架的問題。 當我在我的設備上運行代碼時,它發送請求,但didReceiveResponse沒有被調用。我在我的代碼中做錯了嗎? 請指導我...感謝所有幫助
- (void)viewDidLoad
{
NSLog(@"View is loaded");
[self requestProductData];
if ([SKPaymentQueue canMakePayments])
{
NSLog(@"can make payments");
}
else
{
NSLog(@"cannot make payments");
}
[super viewDidLoad];
}
- (void) requestProductData
{
NSSet *productIDs = [NSSet setWithObjects:@"com.mycompany.inapppurchasetesting.productid", nil];
SKProductsRequest *request = [[SKProductsRequest alloc] initWithProductIdentifiers:productIDs];
request.delegate = self;
NSLog(@"Requesting");
[request start];
}
- (void)productsRequest:(SKProductsRequest *)request didReceiveResponse:(SKProductsResponse *)response
{
NSArray *myProduct = response.products;
NSArray *myInvalidProducts = response.invalidProductIdentifiers;
NSLog(@"Did recieve response");
NSLog(@"Response count is %d",response.products.count);
NSLog(@"Invalid response count is %d",response.invalidProductIdentifiers.count);
for (int i = 0; i<myProduct.count; i++)
{
NSLog(@"t:%@",[[myProduct objectAtIndex:i] localizedTitle]);
}
for(int i = 0; i < myInvalidProducts.count; i++)
{
NSLog(@"Invalid products:%@",[myInvalidProducts objectAtIndex:i]);
}
// populate UI
[request autorelease];
}