Master
iOS only.
After launching the app from a terminated state via an App Store promoted product, the iap-promoted-product event is received immediately.
The iap-promoted-product is never received.
Real device (iPhone 5s running iOS 11.0.3). Confirmed with a colleague using an iPhone 6S.
iap-promoted-product event in the React Native constructor of the app鈥檚 entry point (for me, this is App.js). This is happening because of a race condition on older/slower devices where the React Native bridge is not creating an instance of RNIapIos before iOS invokes the -[paymentQueue:shouldAddStorePayment:forProduct:] delegate of SKPaymentTransactionObserver.
The solution is to create a singleton that only responds to-[paymentQueue:shouldAddStorePayment:forProduct:] and initialise the singleton _as early as possible_ in -[application:didFinishLaunchingWithOptions:]. RNIapIos will be a delegate to this singleton and will emit the iap-promoted-product event when appropriate.
I already have this working and I鈥檓 happy for this issue to be assigned to me. I just need some guidance from @hyochan on the naming convention I should follow for this new class. Once I have that information, I can open a pull request with my implementation. I鈥檇 like to suggest IAPPromotionObserver as a potential class name.
I am very pleased with your work and all your contributions so far.
I think what you've suggested is already an excellent option IAPPromotionObserver as we've discussed this in earlier PR, no-ops on android would be fine.
Thank you again for your great work.
Most helpful comment
I am very pleased with your work and all your contributions so far.
I think what you've suggested is already an excellent option
IAPPromotionObserveras we've discussed this in earlierPR, no-ops onandroidwould be fine.Thank you again for your great work.