productsRequest响应方法未调用?

内容来源于 Stack Overflow,并遵循CC BY-SA 3.0许可协议进行翻译与使用

  • 回答 (2)
  • 关注 (0)
  • 查看 (22)

发送请求

- (void) requestProductData
{
 SKProductsRequest *request= [[SKProductsRequest alloc] initWithProductIdentifiers:
         [NSSet setWithObjects: featureAId,featureBId,nil]]; // add any other product here
 request.delegate = self;
 [request start];
}

响应方法

- (void)productsRequest:(SKProductsRequest *)request didReceiveResponse:(SKProductsResponse *)response
{
 [purchasableObjects addObjectsFromArray:response.products];
}

根本没有接到调用。只有一次,我尝试了十次。

提问于
用户回答回答于

解决方法:

@property (strong, nonatomic) SKProductsRequest *request;

- (void) requestProductData
{
    self.request= [[SKProductsRequest alloc] initWithProductIdentifiers:[NSSet setWithObject:ProductIdentifier]];
    self.request.delegate = self;
    [self.request start];
    // you can nil request property in request:didFailWithError: and requestDidFinish:
}
用户回答回答于

尝试- (void)request:(SKRequest *)request didFailWithError:(NSError *)error方法

扫码关注云+社区