2015-03-11 3 views
1

Я использую cordova для создания приложения в магазине iOS. Я также использую https://github.com/j3k0/cordova-plugin-purchase/blob/master/doc/api.md для интеграции покупки в приложении.iOS inapp покупка плагин возврат null

Я уже создать продукт на моем ITunes подключить и поставить код, как

function initStore(){ 

     if (!window.store) { 
      log('Store not available'); 
      return; 
     } 

     // Enable maximum logging level 
     store.verbosity = store.DEBUG; 

     // Enable remote receipt validation 
     //store.validator = "https://api.fovea.cc:1982/check-purchase"; 

     // Inform the store of your products 
     alert('registerProducts'); 


     store.register({ 
      id: 'com.thegiffary.product.quran_full', 
      alias: 'full version', 
      type: store.NON_CONSUMABLE 
     }); 


     // When any product gets updated, refresh the HTML. 

     store.when("product").updated(function (p) { 
      alert(JSON.stringify(p)) 
     }); 

     // When purchase of the full version is approved, 
     // show some logs and finish the transaction. 
     store.when("full version").approved(function (order) { 
      alert('You just unlocked the FULL VERSION!'); 
      order.finish(); 
     }); 

     // The play button can only be accessed when the user 
     // owns the full version. 
     store.when("full version").updated(function (product) { 
      alert(JSON.stringify(product)) 
     }); 

     // When the store is ready (i.e. all products are loaded and in their "final" 
     // state), we hide the "loading" indicator. 
     // 
     // Note that the "ready" function will be called immediately if the store 
     // is already ready. 
     store.ready(function() { 
      alert('ready') 
     }); 

     // When store is ready, activate the "refresh" button; 
     store.ready(function() { 
      alert('refresh-button') 
     }); 

     // Alternatively, it's technically feasible to have a button that 
     // is always visible, but shows an alert if the full version isn't 
     // owned. 
     // ... but your app may be rejected by Apple if you do it this way. 
     // 
     // Here is the pseudo code for illustration purpose. 

     // myButton.onclick = function() { 
     // store.ready(function() { 
     //  if (store.get("full version").owned) { 
     //  // access the awesome feature 
     //  } 
     //  else { 
     //  // display an alert 
     //  } 
     // }); 
     // }; 


     // Refresh the store. 
     // 
     // This will contact the server to check all registered products 
     // validity and ownership status. 
     // 
     // It's fine to do this only at application startup, as it could be 
     // pretty expensive. 
     alert('refresh'); 
     store.refresh(); 
    } 

Когда я проверить код на реальном устройстве, то вернуть продукт с нулевой информацией (см рисунок)

enter image description here

Я не уверен, что мне не хватает какой-либо вещи, когда я настраиваю продукт в приложении? Пожалуйста, дайте мне какое-нибудь предложение.

С уважением.

+0

можете ли вы представить весь код, как вы это реализовали, поскольку я пытаюсь его реализовать и проверить, но не смог проверить его надлежащим образом. также дайте мне знать, для чего используется валидатор хранилища. –

+0

Я также получаю null в заголовке desc и т. Д., Но в состоянии я регистрируюсь. Пожалуйста, дайте мне знать, как вы это решили. –

ответ

0

У меня возникла аналогичная проблема при разработке приложения для Android в приложении. Я собираюсь взять удар в темноте и предположить, что проблема может быть аналогичной. Моя проблема заключалась в том, что идентификатор моего продукта не соответствовал тому, что я пытался извлечь из магазина.

Идентификатор продукта и его тип должны соответствовать продуктам, определенным на консолях разработчика Apple и Google.

В моем случае, когда продукт загружен, он имел те же значения полей, что и тот, который вы сейчас получаете. Я изменил идентификатор, и он загрузился отлично. Вы можете проверить эти два значения в своей функции store.register.

Смежные вопросы