diff --git a/ios/RNIapIos.m b/ios/RNIapIos.m index fb20c07d8..b9b37931a 100644 --- a/ios/RNIapIos.m +++ b/ios/RNIapIos.m @@ -336,16 +336,22 @@ - (BOOL)paymentQueue:(SKPaymentQueue *)queue shouldAddStorePayment:(SKPayment *) }]; } + RCT_EXPORT_METHOD(presentCodeRedemptionSheet:(RCTPromiseResolveBlock)resolve reject:(RCTPromiseRejectBlock)reject) { +#ifdef __IPHONE_14_0 if (@available(iOS 14.0, *)) { [[SKPaymentQueue defaultQueue] presentCodeRedemptionSheet]; resolve(nil); } else { reject([self standardErrorCode:2], @"This method only available above iOS 14", nil); } +#else + reject([self standardErrorCode:2], @"This method only available above iOS 14", nil); +#endif } + #pragma mark ===== StoreKit Delegate -(void)productsRequest:(SKProductsRequest *)request didReceiveResponse:(SKProductsResponse *)response {