Skip to content

Commit

Permalink
SKProductsRequest as class level variable
Browse files Browse the repository at this point in the history
Needs improvement; see chirag04#48
  • Loading branch information
gtebbutt committed Nov 27, 2017
1 parent b22fdf2 commit ca5b389
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions InAppUtils/InAppUtils.m
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ @implementation InAppUtils
{
NSArray *products;
NSMutableDictionary *_callbacks;
SKProductsRequest *request;
}

- (instancetype)init
Expand Down Expand Up @@ -191,11 +192,10 @@ - (void)paymentQueueRestoreCompletedTransactionsFinished:(SKPaymentQueue *)queue
RCT_EXPORT_METHOD(loadProducts:(NSArray *)productIdentifiers
callback:(RCTResponseSenderBlock)callback)
{
SKProductsRequest *productsRequest = [[SKProductsRequest alloc]
initWithProductIdentifiers:[NSSet setWithArray:productIdentifiers]];
productsRequest.delegate = self;
_callbacks[RCTKeyForInstance(productsRequest)] = callback;
[productsRequest start];
request = [[SKProductsRequest alloc] initWithProductIdentifiers:[NSSet setWithArray:productIdentifiers]];
request.delegate = self;
_callbacks[RCTKeyForInstance(request)] = callback;
[request start];
}

RCT_EXPORT_METHOD(canMakePayments: (RCTResponseSenderBlock)callback)
Expand Down

0 comments on commit ca5b389

Please sign in to comment.