城市飞艇的可变问题

发布于 2025-01-02 15:46:03 字数 788 浏览 4 评论 0原文

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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

何以畏孤独 2025-01-09 15:46:03

对于任何遇到这个问题的人,

您需要先声明变量“UrbanAirship”,然后再尝试分配密钥、秘密等值。

一样,

var UrbanAirship = require('ti.urbanairship');

就像在输入之前

UrbanAirship.key='XXX';
UrbanAirship.secret ='XXX';
UrbanAirship.master_secret='XXX';
UrbanAirship.baseurl = 'https://go.urbanairship.com';

错误消息非常简单。系统找不到该变量,因为它未定义。

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

var UrbanAirship = require('ti.urbanairship');

before typing in

UrbanAirship.key='XXX';
UrbanAirship.secret ='XXX';
UrbanAirship.master_secret='XXX';
UrbanAirship.baseurl = 'https://go.urbanairship.com';

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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文