简体   繁体   English

在iOS中购买App(Appcelerator)

[英]In App purchase for iOS (Appcelerator)

I want to add in-app purchase functionality for iOS but I can't make it working. 我想为iOS添加应用内购买功能,但无法正常运行。

I tried to use ti.storekit, but when I initialize it I get error that addTransactionObserver is undefined and this is crucial function on initialization. 我尝试使用ti.storekit,但是在对其进行初始化时,我收到addTransactionObserver错误消息,即addTransactionObserver未定义,这对初始化至关重要。

Does anyone have luck with it? 有人有运气吗?

My code: 我的代码:

var storekit = require('ti.storekit');
var transactionStateChanged = function(e) {
    alert(e)
}


function init() {
    storekit.receiptVerificationSandbox = Ti.App.deployType !== 'production';
    storekit.bundleVersion = '1.0.4';
    storekit.bundleIdentifier = 'pl.aplikacjanowa';
    storekit.addEventListener('transactionState', transactionStateChanged);
    storekit.addTransactionObserver();
}

init();

Error: 错误:

[INFO] :   [object TiStorekitModule] loaded
[ERROR] :  Script Error {
[ERROR] :      column = 37;
[ERROR] :      line = 598;
[ERROR] :      message = "undefined is not a function (evaluating 'storekit.addTransactionObserver()')";
[ERROR] :      sourceURL = "file:///xyz"; //instead of xyz is path to file in which that function invoked
[ERROR] :      stack = "init@file:///xyz"; //instead of xyz is path to file in which that function invoked
[ERROR] :  }

It seems you initially used outdated version of the module or incorrectly compiled it. 看来您最初使用的是模块的过时版本或未正确编译。

As you mention in your comment something did go wrong with compiling I'm assuming that is the issue. 正如您在评论中提到的那样 ,编译确实出现了问题,我认为这就是问题所在。 A good description how to implement the module is on Medium , and releases are available for download from the Appcelerator GitHub . Medium上很好地描述了如何实现该模块,并且可以从Appcelerator GitHub下载版本。 Don't trust on Gitt.io from always having the latest. 不要一直拥有最新消息,不要相信Gitt.io。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何使用Appcelerator Titanium创建iOS应用程序内购买? - How to create an iOS in-app purchase with Appcelerator Titanium? Appcelerator iOS应用未全宽 - Appcelerator iOS app is not full width Titanium Appcelerator App(IOS)发布问题 - Titanium Appcelerator App (IOS) publishing issue Appcelerator IOS后台在运行应用程序或SyncTask时? - Appcelerator IOS background while app is running or SyncTask? 在5.0和ios8.4中开发的#appcelerator应用不再在ios9.2和appcelerator 5.1.1上运行 - #appcelerator app developed in 5.0 and ios8.4 no longer runs on ios9.2 and appcelerator 5.1.1 Appcelerator 应用程序,iOS 审阅者拒绝了应用程序构建,因为模拟器中不存在问题 - Appcelerator app, iOS reviewer rejected app build for issue not present in the Simulator 无法使用 iOS OpenCV 模块从 Titanium Appcelerator 编译应用程序 - Can't compile App from Titanium Appcelerator with iOS OpenCV Module 我的应用程序未出现在iOS通知中心中-Appcelerator - My app does not appear in the iOS notification center - Appcelerator Titanium Appcelerator可以用于Windows计算机中的IOS App开发吗 - Can Titanium Appcelerator be used for IOS App development in a Windows Machine 在没有TabGroup或NavBar的Titanium Appcelerator中向iOS应用添加“后退”按钮 - Adding a Back button to a iOS app in Titanium Appcelerator without TabGroup or NavBar
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM