一、请求商品
下面是请求商品的代码:
- (void)validateProductIdentifier:(NSArray *)productIdentifier {SKProductsRequest *productRequest = [[SKProductsRequest alloc] initWithProductIdentifiers:[NSSet setWithArray:productIdentifier]];self.request = productRequest;productRequest.delegate = self;[productRequest start];
}#pragma mark - SKProductsRequestDelegate Protocol
- (void)productsRequest:(SKProductsRequest *)request didReceiveResponse:(SKProductsResponse *)response {self.products = response.products;[response.products enumerateObjectsUsingBlock:^(id _Nonnull obj, NSUInteger idx, BOOL * _Nonnull stop) {SKProduct *product = (SKProduct *)obj;NSLog(@"valid identifier: %@", product.productIdentifier); }];for (NSString *invalidIdentifier in response.invalidProductIdentifiers) {// invalid identifierNSLog(@"invalid identifier: %@", inva