城市飞艇的可变问题
Titanium SDK 版本:1.8.0.1
iPhone SDK 版本:4.3
我正在使用 Appcelerator 构建 iOS 应用程序。我尝试使用官方 Appcelerator wiki 指南为 Urban Airship 设置推送通知: https://wiki.appcelerator.org/display/guides/Push+Notifications+with+Urban+Airship。
首先,我将urbanairship.js 文件包含到app.js 文件中。
Ti.include('urbanairship.js');
然后我添加这些行(我用 XXX 替换了我的令牌):
UrbanAirship.key='XXX';
UrbanAirship.secret ='XXX';
UrbanAirship.master_secret='XXX';
UrbanAirship.baseurl = 'https://go.urbanairship.com';
当我在模拟器中运行应用程序时,我收到此错误:
Script Error = Can't find variable: UrbanAirship at app.js (line 9).
我缺少什么?
Titanium SDK version: 1.8.0.1
iPhone SDK version: 4.3
I am building an iOS app using Appcelerator. I try to setup push notifcations for Urban Airship using the official Appcelerator wiki guide: https://wiki.appcelerator.org/display/guides/Push+Notifications+with+Urban+Airship.
First I include the urbanairship.js file into the app.js file.
Ti.include('urbanairship.js');
Then I add these for lines (I replaced my tokens with XXX):
UrbanAirship.key='XXX';
UrbanAirship.secret ='XXX';
UrbanAirship.master_secret='XXX';
UrbanAirship.baseurl = 'https://go.urbanairship.com';
When I run the app in the simulator I get this error:
Script Error = Can't find variable: UrbanAirship at app.js (line 9).
What am I missing?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
对于任何遇到这个问题的人,
您需要先声明变量“UrbanAirship”,然后再尝试分配密钥、秘密等值。
一样,
就像在输入之前
错误消息非常简单。系统找不到该变量,因为它未定义。
PS - 我相信“Ti.include”最适合在尝试包含 .js 文件而不是模块时使用。
For anyone stumbling on this one,
You need to declare the variable 'UrbanAirship' before trying to assign values like key, secret, etc.
something like
before typing in
The error message is quite straightforward. The system cannot find the variable because it is not defined.
PS - I believe 'Ti.include' is best used when trying to include .js files and not for modules.