Skip to content

Commit

Permalink
Retain products request robotmedia#229
Browse files Browse the repository at this point in the history
If not retained, on tvOS will be always released and the delegate won't be called.
  • Loading branch information
everappz committed Mar 24, 2024
1 parent 91cc3c8 commit 48281e2
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion RMStore/RMStore.m
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,7 @@ @interface RMProductsRequestDelegate : NSObject<SKProductsRequestDelegate>
@property (nonatomic, copy) RMSKProductsRequestSuccessBlock successBlock;
@property (nonatomic, copy) RMSKProductsRequestFailureBlock failureBlock;
@property (nonatomic, weak) RMStore *store;
@property (nonatomic, strong) SKProductsRequest *productsRequest;

@end

Expand Down Expand Up @@ -253,7 +254,7 @@ - (void)requestProducts:(NSSet*)identifiers

SKProductsRequest *productsRequest = [[SKProductsRequest alloc] initWithProductIdentifiers:identifiers];
productsRequest.delegate = delegate;

delegate.productsRequest = productsRequest;
[productsRequest start];
}

Expand Down Expand Up @@ -787,6 +788,7 @@ - (void)postNotificationWithName:(NSString*)notificationName transaction:(SKPaym

- (void)removeProductsRequestDelegate:(RMProductsRequestDelegate*)delegate
{
delegate.productsRequest = nil;
[_productsRequestDelegates removeObject:delegate];
}

Expand Down

0 comments on commit 48281e2

Please sign in to comment.