I’m using SDKBOX IAP version 2.3.17.9 plugin on Cocos2d-x 3.16 project. Here’s the issue:
After I call sdkbox::IAP::purchase(“product_id”) there is a long timeout: 30-60sec. After that either I see a message that I can not connect to iTunes Store, or I see purchase confirmation alert and after confirmation there is also long timeout with an error in the end.
NOTES:
— Network is fine
— productRequestSuccessCallback is called with correct product
— I tried to enable/disable In-App Purchase project capability and it does not help
— The In-App Purchase in “Waiting for review” state right now.
— I did not find out how to whitelist canOpenUrl function since it requires to provide a schemes in LSApplicationQueriesSchemes and there is no word about scheme on SDKBOX documentation
— Here’s code:
AppDelegate.cpp:
#include “IAPManager.h”
#include “PluginGoogleAnalytics/PluginGoogleAnalytics.h”
#include “PluginReview/PluginReview.h”
#include “AppDelegate.h”
…
bool AppDelegate::applicationDidFinishLaunching() {
…
sdkbox::PluginGoogleAnalytics::init();
sdkbox::PluginReview::init();
sdkbox::IAP::setDebug(true);
IAPManager::getInstance();
sdkbox::IAP::init();
return true;
}
…
IAPManager.cpp:
#include <math.h>
#include "IAPManager.h"
#include "ProgressTracker.h"
USING_NS_CC;
IAPManager* IAPManager::_instance = nullptr;
IAPManager::IAPManager() {}
IAPManager* IAPManager::getInstance() {
if (IAPManager::_instance == nullptr) {
CCLOG("creating listener");
IAPManager::_instance = new IAPManager();
sdkbox::IAP::setListener(IAPManager::_instance);
}
return IAPManager::_instance;
}
IAPManager::~IAPManager() {
sdkbox::IAP::removeListener();
}
void IAPManager::onInitialized(bool ok) {
CCLOG("initialized %d", ok);
}
void IAPManager::onSuccess(sdkbox::Product const& p) {
CCLOG("success");
}
void IAPManager::onFailure(sdkbox::Product const& p, const std::string &msg) {
CCLOG("failure %s", msg.c_str());
}
void IAPManager::onCanceled(sdkbox::Product const& p) {
CCLOG("canceled");
}
void IAPManager::onRestored(sdkbox::Product const& p) {
CCLOG("restored");
}
void IAPManager::onProductRequestSuccess(std::vector<sdkbox::Product> const &products) {
auto product = products[0];
CCLOG("products request success %s", product.id.c_str());
}
void IAPManager::onProductRequestFailure(const std::string &msg) {
CCLOG("product request failuer%s", msg.c_str());
}
void IAPManager::onRestoreComplete(bool ok, const std::string &msg) {
CCLOG("restore complete %d %s", ok, msg.c_str());
}