Question

I know the question has been asked so many times. I have looked all of it but i couldn't able to fix this issue.

I have added Storekit framework and created and InAppPurchaseManager class of type NSObject.

I am making an instance where i need to make a product request.

InAppPurchaseManager *inApp = [[InAppPurchaseManager alloc] init];
[inApp loadStore:@"TestProduct"];

I have made a class property of SKProductsRequest.

@property (retain, nonatomic) SKProductsRequest *productsRequest;

//loadStore Method

- (void)loadStore:(NSString *)_productID
{
    productID = _productID;
    // restarts any purchases if they were interrupted last time the app was open
    [[SKPaymentQueue defaultQueue] removeTransactionObserver:self];   
    // get the product description (defined in early sections)
    [self requestProUpgradeProductData];
}

- (void)requestProUpgradeProductData 
{

    NSSet *productIdentifiers = [NSSet setWithObject:productID];
    self.productsRequest = [[SKProductsRequest alloc]     
        initWithProductIdentifiers:productIdentifiers];
    self.productsRequest.delegate = self;
    [self.productsRequest start];
}

//Delegates

- (void)productsRequest:(SKProductsRequest *)request didReceiveResponse:                               
      (SKProductsResponse *)response
{
    //never being called    
}

- (void)requestDidFinish:(SKRequest *)request 
{
    //never being called
}

- (void)request:(SKRequest *)request didFailWithError:(NSError *)error 
{
    //never being called
}

My interface looks like this

@interface InAppPurchaseManager : NSObject <SKProductsRequestDelegate, SKPaymentTransactionObserver, SKRequestDelegate>

Please suggest how can i fix this problem.

Edit: As this

[self.productsRequest start];

executes it comes in

-(void) dealloc {

}
Was it helpful?

Solution

This issue is fixed by making property of InAppPurchaseManager.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top