我一直在使用appcelerator来构建移动原生应用。最近,我需要添加一个新功能 - 应用内消息传递。经过一些谷歌搜索,似乎pubnub是一个可行的解决方案。所以,我使用从https://www.pubnub.com/docs/titanium-javascript/pubnub-javascript-sdk下载的pubnub.js
来关注https://github.com/pubnub/javascript/blob/master_3x/titanium/dist/pubnub.js的说明。
问题是此错误消息始终提示我:"Can't find variable: PUBNUB"
。所以,如果有任何与使用PUBNUB
PUBNUB.uuid()
相关的内容,那么它就不会起作用!
但是,如果我将var pubnub = require("pubnub");
更改为Ti.include('pubnub.js');
,它可以正常工作(只有指令中显示的基本功能,如上面的链接所示)。我该怎么办才能让它发挥作用?
我使用的框架的信息:
Appcelerator Studio 4.7.0
Titanium 5.4.0
我使用的测试环境的信息:
模拟器 - iPad2(v9.3)