react-native-iap: Can't run on iOS due to 'unknown type name 'SKPaymentDiscount'

Version of react-native-iap

2.4.9

Version of react-native

0.59.5

Platforms you faced the error (IOS or Android or both?)

iOS

Expected behavior

App builds

Actual behavior

App doesn’t build

Tested environment (Emulator? Real Device?)

Emulator

Steps to reproduce the behavior

Just react-native run-ios with the above versions of react-native-iap and React native

This is the exact error I get:

/node_modules/react-native-iap/ios/RNIapIos.m:167:5: unknown type name 'SKPaymentDiscount'; did you mean 'SKProductDiscount'?

I tried renaming SKPaymentDiscount to SKProductDiscount just to see and I was getting different errors.

Let me know if you have any questions.

About this issue

  • Original URL
  • State: closed
  • Created 5 years ago
  • Reactions: 3
  • Comments: 38 (10 by maintainers)

Most upvoted comments

i having this issue too on version 2.4.11. The only version that worked before @hyochan made a changes is 2.4.8

Same problem with Xcode 10.1, I can’t update XCode to 10.2 because it needs OSX 10.14.3, not suppported by my old iMac stuck at 10.13.6.

@hyochan thank you for your great support!

I just tried all the hints mentioned in this issue (completely removed node_modules before npm install, clean app, removed ios/build). Unfortunately I am still getting this issue in combination with build target 11.2 and react-native-iap v3.2.2. I also tried downgrading to v2.4.8, which leads to a successful build. Moreover I tried to setup IapExample but end up in this react-native issue (https://github.com/facebook/react-native/issues/25252)

I was running into this issue. Updating my xcode from 10.1 to 10.2.1 fixed my issue. I am able to build my project now.

It will from 3.0.0

Yes, me too ! excellent work from the maintainers !

react-native: 0.59.0 react-native-iap:2.4.8 Xcode: 10.1 Successfully Built Project. Thanks

@liudmyla-schastlyvets I can’t build with 10.1, I had to use another computer with Xcode lastest version 😦

Is the payment with apple Pay (and no popup) going to work ?

We need to keep both version sync if we want to use in production library.

We cannot choose between version > 12 or version < 12 for business !

There are probably something i don’t get ! Thanks for your work @hyochan !

Hello @ndejesus1227, that’s on me, sorry. What is actually happening is that your iOS version is below 12.2. As the Apple documentation describes, the SKPaymentDiscount is available only for iOS 12.2+.

I was suppose to verify the actual iOS version, but ended up forgetting.