Pre-requisites
IAP Checklist
Also I have now got a CocoonJS premium account which gave me compile options for Cocoonjs store and added the IAP to cocoonjs store.
Link to .capx file (required!):
https://dl.dropbox.com/u/2175584/Construct2Examples/IAPTest.capx
Steps to reproduce:
1. Launch compiled project from ludei (cocoonJS) in xcode
2. Observer console log
3. Comment out the on start (crashes app)
4. Load again
5. Press the buy button
6. Observer console log
Observed result:
Console log :
At Start:
JavaScript Exception ( Tag: 'timer'): Exception calling 'IDTK_SRV_STORE' extension with
'isFeaturePurchased' funtionName: IllegalStateException: Trying to use a non started service
at virtual bool com::ideateca::service::store::AbstractStoreService::isFeaturePurchased(const
string &) const:519
JavaScript Exception ( Tag: 'touchstart'): Exception calling 'IDTK_SRV_STORE' extension
with 'isFeaturePurchased' funtionName: IllegalStateException: Trying to use a non started
service at virtual bool
com::ideateca::service::store::AbstractStoreService::isFeaturePurchased(const string &) const:519
Expected result:
Am I getting this error because CocoonJS.Store.start(); isn't being called in c2runtime.js. I have tried manually executing this function from C2 using callJs.
Browsers affected:
Chrome: no
Firefox: no
Internet Explorer: no
CocoonJS: yes
Operating system & service pack:
Windows 8
Construct 2 version:
r122
Notes:
Looking at Ludei's example IAP they have this code in their HTML:
isStoreAvailable = false;
products = new Array();
purchases = new Array();
if (CocoonJS.Store.nativeExtensionObjectAvailable && CocoonJS.Store.canPurchase())
{
isStoreAvailable = true;
CocoonJS.Store.onProductsFetchStarted.addEventListener(onProductsFetchStarted);
CocoonJS.Store.onProductsFetchFailed.addEventListener(onProductsFetchFailed);
CocoonJS.Store.onProductsFetchCompleted.addEventListener(onProductsFetchCompleted);
CocoonJS.Store.onRestorePurchasesStarted.addEventListener(onRestorePurchasesStarted);
CocoonJS.Store.onRestorePurchasesCompleted.addEventListener(onRestorePurchasesCompleted);
CocoonJS.Store.onRestorePurchasesFailed.addEventListener(onRestorePurchasesFailed);
CocoonJS.Store.onProductPurchaseStarted.addEventListener(onProductPurchaseStarted);
CocoonJS.Store.onProductPurchaseFailed.addEventListener(onProductPurchaseFailed);
CocoonJS.Store.onProductPurchaseCompleted.addEventListener(onProductPurchaseCompleted);
CocoonJS.Store.start();
refreshProducts();
refreshPurchases();
CocoonJS.Ad.preloadBanner();
CocoonJS.Ad.setBannerLayout(CocoonJS.Ad.BannerLayout.BOTTOM_CENTER);
}
Does that need to be somewhere in c2runtime.js as no html file is made for cocoonjs?