React-native-iap: iOS version will not build

Created on 24 Apr 2019  路  8Comments  路  Source: dooboolab/react-native-iap

Version of react-native-iap

2.4.9

Version of react-native

0.57.4

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

ios

Expected behavior

Not fail to build in xcode

Actual behavior

Fails to build in xcode

Tested environment (Emulator? Real Device?)

Read Device

Steps to reproduce the behavior

I followed steps in the readme
Screen Shot 2019-04-23 at 10 04 46 PM

馃摫 iOS 馃檹 help wanted

Most helpful comment

have the same issue
i followed all steps from the readme
Error: E_IAP_NOT_AVAILABLE

All 8 comments

have the same issue
i followed all steps from the readme
Error: E_IAP_NOT_AVAILABLE

I updated [email protected] and solved

@kilicfurkan
It works! Thank you

@josesn What version of react-native and react-native-iap are you using? I changed to [email protected] and now I am getting Build input file cannot be found: '/Users/austinkyker/projects/bagszn/bagszn/node_modules/react-native-iap/ios/IAPPromotionObserver.m'

@akyker20
react-native : 0.57.7
react-native-iap : 2.3.23

@josesn What version of react-native and react-native-iap are you using? I changed to [email protected] and now I am getting Build input file cannot be found: '/Users/austinkyker/projects/bagszn/bagszn/node_modules/react-native-iap/ios/IAPPromotionObserver.m'

You can add 'IAPPromotionObserver.m' file manually like this: https://github.com/facebook/react-native/issues/19569#issuecomment-394869470

@akyker20 Mostly, these kinds of issues are not actually related to the module itself. Please see more information on linking issue in react-native itself.

I had the same issue today when I've added one more person to the project and he has executed a command pod install on a clean environment (without pod source cached) and on Xcode older than 10.2. You can reproduce that issue by executing pod cache clean 'RNIap' --all , then install pods again and try to build project.

There are two reasons why that happened:
1) the first one that the podspec source parameter points to the master branch (I'm using old version of react-naive-iap library), but not to a certain tag or commit. The master branch is constantly updating, thus such podspec doesn't freeze the version of iOS related code , and in some moment it could become incompatible with JS code of the library or even with version of iOS SDK.
2) the second one that class SKPaymentDiscount appears only in iOS SDK 12.2 and doesn't supported in previous versions of iOS SDK. Xcode usually ships together with new version of iOS SDK and do not provide that sdk for old versions of Xcode. In many case, for example mine, developer can't upgrade Xcode version right when it released.

To resolve this issue I recommend to use modern API availability checks (namely @available) for code uses SKPaymenDiscount . But also I strongly recommend don't use dynamic point for source parameter in podspec such as some branch, and instead of it use the tag with the same name as npm package has (simply replace :tag => "stable" on :tag => package['version'] in podspec file) and create tags in GitHub repository together with new npm package version.

If that will be suitable I could provide pull request for these recommendations.

Was this page helpful?
0 / 5 - 0 ratings