SKProductsRequest crashes Mac OS X

xCode 7.3, Mac OSX 10.11.4



    self.productsRequest= [[SKProductsRequest alloc] initWithProductIdentifiers: [NSSet setWithObject: self.productIdentifier]];
    self.productsRequest.delegate = self;
    [self.productsRequest start];


I have enabled my app for In app purchases. I have added a product in ITunes Connect. This particular class is defined as:

NSObject <SKRequestDelegate, SKProductsRequestDelegate>

And it has the methods:

- (void)productsRequest:(SKProductsRequest *)request didReceiveResponse:(SKProductsResponse *)response

- (void)requestDidFinish:(SKRequest *)request

- (void)request:(SKRequest *)request didFailWithError:(NSError *)error


I have the valid product Identifer set to the correct string identifying the product.

When I run the code, it either hangs or it crashes. None of the delegate methods are called.

Answered by rschluet in 131532022

OK, got it. My SKRequestDelegate was being released before the request could be processed. My bad.

Accepted Answer

OK, got it. My SKRequestDelegate was being released before the request could be processed. My bad.

SKProductsRequest crashes Mac OS X
 
 
Q