question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

RNIapQueue.shared as undefined in AppDelegate for promoted products in ios

See original GitHub issue

Please use Discussion board if you want get some help out of it. Please report issue if there is a bug.

Version of react-native-iap

8.0.0

Version of react-native

0.67

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

ios

Expected behavior

Able to add listener for SKPaymentQueue in AppDelegate

Actual behavior

RNIapQueue module is not available if your create an AppDelegate.swift file with bridging header?

Tested environment (Emulator? Real Device?)

Steps to reproduce the behavior

  1. create new swift file with name AppDelegate.swift
  2. xcode asks to create Bridging Header file and click yes
  3. follow Troubleshooting instructions
import UIKit
import StoreKit

class AppDelegate: UIResponder, UIApplicationDelegate {
                ....
    // Attach an observer to the payment queue.
    func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {
        SKPaymentQueue.default().add(RNIapQueue.shared)
        return true
    }

    // Called when the application is about to terminate.
    func applicationWillTerminate(_ application: UIApplication) {
        // Remove the observer.
        SKPaymentQueue.default().remove(RNIapQueue.shared)
    }
                ....
}

RNIapQueue.shared shows as undefined and build fails

Issue Analytics

  • State:closed
  • Created a year ago
  • Reactions:2
  • Comments:5

github_iconTop GitHub Comments

1reaction
alburdette619commented, Jul 5, 2022

After some research, I set all of my targets’ Objective-C Generated Interface Header Name to the same & attempted to use #import <{ProductName}-Swift.h> but the build still failed with the same error.

1reaction
alburdette619commented, Jul 5, 2022

I’m in this position currently. Following the docs here is very rough if you have an objective c AppDelegate & aren’t as knowledgable outside the JS context. The method names for SKPaymentQueue are even different in objective c, default vs defaultQueue & add vs addTransactionObserver for examples.

Screen Shot 2022-07-05 at 10 11 26 AM

Tbh I don’t even know if this is how you pass arguments to method calls here, but the symbol definitely isn’t defined.

Read more comments on GitHub >

github_iconTop Results From Across the Web

unrecognized selector sent to instance" error since version ...
Open ios/ArticleTest5.xcworkspace in XCode; Choose ArticleTest5Clip target and click Run; Error should be thrown. Repositories: Working App Clip ...
Read more >
dooboolab/react-native-iap (Raised $40.00) - Issuehunt
[iOS] getSubscriptions isn't the same on emulator and in phone ... RNIapQueue.shared as undefined in AppDelegate for promoted products in ios.
Read more >
react-native-iap - bytemeta
Receipt missing data IOS. fontesrp ... RNIapQueue.shared as undefined in AppDelegate for promoted products in ios. adambeer.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found