About the error code of Ti.StoreKit-1.6.0

You must Login before you can answer or comment on any questions.

I develop now using Ti.storekit-1.6.0. (TitaniumStudio SDK-2.1.3GA)

Description below shows the current my test code

$btnItem1.addEventListener('click', function(e){
 // 250 
var product = 'net.oratta.info.0250';
var Storekit = require('ti.storekit');
Storekit.purchase(product, function (evt) {
         switch (evt.state) {
              case Storekit.FAILED:
                      alert('ERROR: Buying failed!');
                      break;
               case Storekit.PURCHASED:
               case Storekit.RESTORED:
                      alert('Thanks!');
                      //markProductAsPurchased(product.identifier);
                      break;
          }
     });
 });
The information of iTuensConnect has become like below
AppleID : '567415203'
BundleID : 'net.oratta.info'
[In-App Purchase Summary] 
ReferenceName: '250 Coin' 
ProductID: 'net.oratta.info.0250'
Type: Consumable
AppleID: '568619867'
But, following kind of error coming out, it does not operate normally(It is the test with the apparatus)
"-[__NSCFString product]: unrecognized selector sent to instance 0x1d4f7c20"
At the time of Ti.StoreKit-1.5.0 the same error came out.

Because Ti.StoreKit upgraded, this error is to think that it does not come out anymore, but...

When how it does, this error can be evaded?

I request your advice.

Thanks,

[Environment] Mac OS X 10.7.5 XCode Version 4.5 (4G182) Titanium Mobile SDK (2.1.3.GA) Ti.storeKit(1.6.0) iPhone SDK version: 6.0 iPhone simulated device: iphone

4 Answers

I've not received that error message during my storekit development, but make sure you are doing the following when testing storekit transactions on a device:

  • To test on a device, get into Settings / Store and SIGN OFF the iTunes account. Do not specify a different account, though.
  • Run your app on the device. When doing an in-app purchase, you will be prompted for an itunes account. Use the Test user account you set up in iTunesConnect.
  • In-app purchases should work.
  • After testing, change the itunes account back to the one used along with TI, in Settings/Store on the device.

Hi Kota, I hope you have already found a solution to this issue.

I started using ti.storekit today and faced the same problem. After stressful and exhausting testing I realized that the issue here is the parameter we were passing to Storekit.purchase method.

This method expects an object and not a string. I solve my problem calling Storekit.requestProducts first as you can see in the code below:

var Storekit = require('ti.storekit');
var productID = 'net.oratta.info.0250';
var productObject = null;
 
Storekit.requestProducts([productID], function (e) {
           if (!e.success) { alert('ERROR: We failed to talk to Apple!');
    } else if (e.invalid) { alert('ERROR: We requested an invalid product!');
    } else {
        productObject = e.products[0];
        // ...
        // ... any code to show a message asking the user to by the product
        // ...
    };
});
 
// when the user confirm the purchase, the code below should be executed
 
Storekit.purchase(productObject, function (e) {
    switch (e.state) {
        case Storekit.FAILED:
            alert('ERROR: Buying failed!');
            break;
        case Storekit.PURCHASED:
            markProductAsPurchased(productID);
            alert('Restored. Thanks!');
            break;
        case Storekit.RESTORED:
            markProductAsPurchased(productID);
            alert('Purchased. Thanks!');
            break;
    };
});

— answered 6 months ago by Jose Cotrim
answer permalink
1 Comment
  • I have just realized that the alerts in my code are inverted (purchased x restored).

    — commented 6 months ago by Jose Cotrim

Thanks!

I am performing all the things you pointed out. However, the error it was written to the question that started an application by a device will occur, and an application will stop.

Although the test user also registered and there is the sign off [ account ] at the time of a test, before the demand of ID from iTunes, etc. comes, an application stops. Isn't there any mistake in my code written to the question somewhere?

I need your advice.

Warm regards,

????????????????Storekit??????????????????????

Note: Store Kit does not operate in iOS Simulator. When running your application in iOS Simulator, Store Kit logs a warning if your application attempts to retrieve the payment queue. Testing the store must be done on actual devices.

??????

Your Answer

Think you can help? Login to answer this question!