From c07ffef35dac4ee299c6a977a7ba2849c0befa85 Mon Sep 17 00:00:00 2001 From: doomsower Date: Sat, 17 Aug 2019 11:56:35 +0300 Subject: [PATCH] fix: make it build with older XCode --- ios/RNIapIos.m | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/ios/RNIapIos.m b/ios/RNIapIos.m index 5cfdd5c85..e37a0b0be 100644 --- a/ios/RNIapIos.m +++ b/ios/RNIapIos.m @@ -180,6 +180,7 @@ - (BOOL)shouldAddStorePayment:(SKPayment *)payment forProduct:(SKProduct *)produ } if (product) { payment = [SKMutablePayment paymentWithProduct:product]; + #if __IPHONE_12_2 if (@available(iOS 12.2, *)) { SKPaymentDiscount *discount = [[SKPaymentDiscount alloc] initWithIdentifier:discountOffer[@"identifier"] @@ -190,6 +191,7 @@ - (BOOL)shouldAddStorePayment:(SKPayment *)payment forProduct:(SKProduct *)produ ]; payment.paymentDiscount = discount; } + #endif payment.applicationUsername = usernameHash; [[SKPaymentQueue defaultQueue] addPayment:payment]; [self addPromiseForKey:RCTKeyForInstance(payment.productIdentifier) resolve:resolve reject:reject]; @@ -567,9 +569,11 @@ -(NSDictionary*)getProductObject:(SKProduct *)product { } NSArray *discounts; + #if __IPHONE_12_2 if (@available(iOS 12.2, *)) { discounts = [self getDiscountData:[product.discounts copy]]; } + #endif NSDictionary *obj = [NSDictionary dictionaryWithObjectsAndKeys: product.productIdentifier, @"productId", @@ -645,6 +649,7 @@ - (NSMutableArray *)getDiscountData:(NSArray *)discounts { NSString* discountIdentifier = @""; + #if __IPHONE_12_2 if (@available(iOS 12.2, *)) { discountIdentifier = discount.identifier; switch (discount.type) { @@ -660,6 +665,7 @@ - (NSMutableArray *)getDiscountData:(NSArray *)discounts { } } + #endif [mappedDiscounts addObject:[NSDictionary dictionaryWithObjectsAndKeys: discountIdentifier, @"identifier",