Unsolved InApp Purchasing C++ not working in Qt 5.11.1 on Mac OS 10.13.6
-
Hi,
i try to implement an In-App-Purchase on Mac OS (10.13.6) with the qt purchase module.I do the following:
m_iapStore = new QInAppStore(this); connect(m_iapStore, SIGNAL(productRegistered(QInAppProduct*)), this, SLOT(markProductAvailable(QInAppProduct*))); connect(m_iapStore, SIGNAL(productUnknown(QInAppProduct::ProductType, const QString &)), this, SLOT(handleErrorGracefully(QInAppProduct::ProductType, const QString &))); connect(m_iapStore, SIGNAL(transactionReady(QInAppTransaction*)), this, SLOT(handleTransaction(QInAppTransaction*)));
void InAppPurchaseManager::markProductAvailable(QInAppProduct *product) { m_inAppFullVersionProduct = product; qInfo() << "InAppPurchaseManager::markProductAvailable: product: " << m_inAppFullVersionProduct; } void InAppPurchaseManager::handleErrorGracefully(QInAppProduct::ProductType productType, const QString &identifier) { qInfo() << "InAppPurchaseManager::handleErrorGracefully: productType:" << productType << " id: " << identifier; } void InAppPurchaseManager::handleTransaction(QInAppTransaction *transaction) { qInfo() << "InAppPurchaseManager::handleTransaction: transaction: " << transaction; } qInfo() << "InAppPurchaseManager::call registerProduct"; m_iapStore->registerProduct(QInAppProduct::Consumable, QStringLiteral("de.myproduct.inapp-id"));
Documentation says:
Registering a product is asynchronous, and will at some point yield one of the following two signals: 1. productRegistered() if the product was found in the external store with a matching type. 2. productUnknown() if the product was not found in the external store with the type you specified.But i do not get any answer / slot called after calling the registerProduct method.
I would expect that either the productUnknown or the productRegistered slot gets called, but nothing happens...Any ideas, what the problem could be?
Greetings
Nando -
Hi
first step is to check return of the connects to see they all return true . -
@mrjj said in InApp Purchasing C++ not working in Qt 5.11.1 on Mac OS 10.13.6:
Hi
first step is to check return of the connects to see they all return true .Hi and thank you.
I chekced connect calls and all look good:if(!connect(m_iapStore, SIGNAL(productRegistered(QInAppProduct*)), this, SLOT(markProductAvailable(QInAppProduct*)))) { qCritical() << "connect failed: productRegistered"; } else { qInfo() << "connect OK: productRegistered"; } if(!connect(m_iapStore, SIGNAL(productUnknown(QInAppProduct::ProductType, const QString &)), this, SLOT(handleErrorGracefully(QInAppProduct::ProductType, const QString &)))) { qCritical() << "connect failed: productUnknown"; } else { qInfo() << "connect OK: productUnknown"; } if(!connect(m_iapStore, SIGNAL(transactionReady(QInAppTransaction*)), this, SLOT(handleTransaction(QInAppTransaction*)))) { qCritical() << "connect failed: transactionReady"; } else { qInfo() << "connect OK: transactionReady"; }
Any other ideas why the slots get not called?
I call this code from my MainWindow constructor. -
Puuh, i can not get it working in my project :-(
Somehow no signals are emitted from the QInAppStore module on MacOS.
I checked it the signals are connected correctly.Maybe i need to add something extra in Info.plist?
Same code in a mini test-project runs fine (but without app bundle, just normal app)
Something in my app seems to block the QInAppStore class to emit signals.
But i use signals slots all over my app and all work perfectly. Only QInAppStore seems not to emit the signals productUnknown(QInAppProduct::ProductType, const QString &) -
@Nando
sadly i have no idea.
Do you use commercial version of Qt ? -
Hi,
Can you provide a minimal buildable example that shows that behaviour ?
-
@mrjj said in InApp Purchasing C++ not working in Qt 5.11.1 on Mac OS 10.13.6:
version of Qt ?
Hi, for my tests i use the open source version.