我是钛的新手,想从我的钛应用程序中调用一个Web服务.webService返回json响应.因为我知道调用webService使用XMLRPC但非常混淆json.
到现在为止,我知道我们必须创造HTTPClient.
var request = Titanium.Network.createHTTPClient();
request.open("POST", "http://test.com/services/json");
request.onload = function() {
var content = JSON.parse(this.responseText);//in the content i have the response data
};
request.setRequestHeader("Content-Type","application/x-www-form-urlencoded"); //did not understand this line
request.send();
Run Code Online (Sandbox Code Playgroud)
现在问题是如果我的url(端点)有许多WebServices,那么我将给出方法名称,即要调用的WS名称.
从钛移动的API文档的功能open,即request.open接受3个参数:
方法名称(http方法名称)
请求的网址
async(boolean property)默认为true.
在上面的代码那里"POST"做什么?如果我的WS名称,system.connect那么我将在代码中提到它?
如果WS需要参数,那么我们如何将参数发送到上面代码的webService.
我知道request.send()可以用来发送参数但是如何?
javascript titanium appcelerator appcelerator-mobile titanium-mobile
无论如何使用Titanium Appcelerator来使用百分比.用于流体和响应设计; 否则看起来我会为所有设备的IF ELSE语句而烦恼!
原始代码
WebViewWindow=Titanium.UI.createWebView({
html:globalHTMLHeadert,
visible:true,
width:100%, //note I have tried also "100%" with/out comma
left:0,
bottom:30%,
zIndex:400
});
Run Code Online (Sandbox Code Playgroud)
我想要
WebViewWindow=Titanium.UI.createWebView({
html:globalHTMLHeadert,
visible:true,
width:320,
left:0,
bottom:150,
zIndex:400
});
Run Code Online (Sandbox Code Playgroud) function insertToProject(cast, pName)
{
db.execute('INSERT INTO project (cd, pn) VALUES (?,?)', cast, pName);
var x = last_insert_rowid();
return x;
}
Run Code Online (Sandbox Code Playgroud)
我一直在使用钛appcelerator中的javascript尝试这个.谁能告诉我我做错了什么?
这是事情:
我正在使用CommonJS方式使我的移动(iPhone/Android)应用程序模块化.这并不奇怪.但有一点我无法理解.
CommonJS让我创建了STATIC私有变量,这让我可以轻松创建单例.至少,我认为这是因为获取require()d 的文件的内容只读取一次,然后每次都返回export对象(只初始化一次).
但是当我创建如下所示的循环引用时,每次都会执行包含模块内的代码.
等等......
有趣的是,在我写这个问题的时候,我突然意识到require()在下一个问题开始之前没有任何调用完成(因此下面显示了堆栈溢出).
关于我是否正常的任何想法?这是凌晨5点过来的所以,所以我所关注的所有赌注都是关闭的:D.
例子:
看到这段代码,它定义了一个单例:
/* Singleton.js */
exports.getSingleton = getSingleton;
function getSingleton(name) {
if (!instance) {
instance = new Thing(name);
}
return instance;
}
function Thing(name) {
this.name = name;
}
var instance;
Run Code Online (Sandbox Code Playgroud)
我require()这个文件是这样的:
var theFirstThing = require('Singleton').getSingleton('first');
Ti.API.info('first: ' + theFirstThing.name)
var possiblyAnotherOtherThing = require('Singleton').getSingleton('second');
Ti.API.info('second: ' + possiblyAnotherOtherThing.name);
Run Code Online (Sandbox Code Playgroud)
输出是:
[DEBUG] loading: /path/to/sim/MyApp.app/app.js, resource: app_js
[DEBUG] loading: /path/to/sim/MyApp.app/Singleton.js, resource: Singleton_js
[INFO] first: first
[INFO] second: first
Run Code Online (Sandbox Code Playgroud)
为什么那样的循环引用如下所示不起作用?(如果你愿意的话,我可能已经自己研究了这个,评论/回答). …
我们在Appcelerator中完成了一个非常基本的应用程序(iOS/Android),每周都会收到一次更新.此更新将发送给订阅推送通知服务的所有用户.
到目前为止,我们上个月在此应用程序上安装了约35,000个活动用户,但有7,000名活跃用户.我们一直在为所有推送通知评估两种服务:
Appcelerator云服务很好,但我们不愿意支付那么多.Parse和StackMob的价格低于Appcelerator Cloud服务,通过我们的分析,我们甚至可以在两种服务上使用免费服务(StackMob = 60k推送通知+ 60k api调用,Parse 1M api调用+ 1M推送).
如果我们要使用Parse,我们需要从Marketplace购买Android和iOS模块(每个30美元/年).哪个好.在对应方面,我认为我们可以使用StackMob上的REST API来订阅推送服务.
问题:
提前致谢.
我在Appcelerator论坛上问了同样的问题.过了一段时间,用户回来时有几个答案和用户使用Parse.com.
我结束了Parse.com的实现,使用Appcelerator Market上的Android和iOS插件非常简单.
最后我在2010年使用了Appcelerators平台,即使生成一个简单的表,我也看到了非常差的性能.有没有人有机会在过去几个月尝试一下?如何使用此平台开发应用程序的整体速度?
我正在直接从钛工作室创建分发版本,以便在iTunes Connect上进行Apple Testflight预发布测试.我目前的应用版本是1.1.1,内部版本号由钛工作室自动设置为1.1.1.
在Xcode上,大多数开发人员通常将预发布版本号(CFBundleVersion)维护为Integer,在iTunes上传之前每次增加1非常方便.从钛工作室这是不可能的!
在tiapp.xml中我设置了这个
<ios>
<plist>
<dict>
<key>CFBundleShortVersionString</key>
<string>1.1.1</string>
<key>CFBundleVersion</key>
<string>10</string>
</dict>
</plist>
</ios>
Run Code Online (Sandbox Code Playgroud)
从Titanium Studio运行后,生成的文件夹下的info.plist变为
<ios>
<plist>
<dict>
<key>CFBundleShortVersionString</key>
<string>1.1.1</string>
<key>CFBundleVersion</key>
<string>1.1.1</string>
</dict>
</plist>
</ios>
Run Code Online (Sandbox Code Playgroud)
我知道在appcelerator文档中他们已经提到了这一点,CFBundleVersion并且CFBundleShortVersionString将从<version>生成的info.plist中的标记值变为相同.
因此,现在使用Apple Testflight for Ti应用程序的唯一方法是每次在iTunes Connect上传时都增加应用程序版本(CFBundleShortVersionString)而不是build#,这绝对不是一个好方法.从Xcode我可以更改Build#,但由于某些模块和其他问题,并非所有Ti应用都会从xcode存档.
在appcelerator社区上有很多关于此问题的帖子,但还没有可接受的解决方案.有没有人在创建分发版本时有一个可以直接从Titanium Studio更改/增加构建#的工作解决方案?
提前致谢.
我正在尝试:
Application Mobile with Alloy
Titanium SDK version: 2.1.3 (10/02/12 16:16 15997d0)
iPhone Device family: universal
iPhone SDK version: 6.0
iPhone simulated device: iphone
Detected compiler plugin: ti.alloy/1.0
Run Code Online (Sandbox Code Playgroud)
我创造了两个模型:
alloy generate model met sql met_id:int libelle:string famille_id:int
alloy generate model famille sql famille_id:int libelle:string
Run Code Online (Sandbox Code Playgroud)
并填写以下数据:
var mets = Alloy.createCollection('Met')
var met = Alloy.createModel("Met",{met_id:1,libelle:"Salade de Chèvre Chaud",famille_id:1});mets.add(met);met.save();
var met = Alloy.createModel("Met",{met_id:2,libelle:"Salade de Chèvre Chaud",famille_id:2});mets.add(met);met.save();
var met = Alloy.createModel("Met",{met_id:3,libelle:"Salade de Chèvre Chaud",famille_id:3});mets.add(met);met.save();
var met = Alloy.createModel("Met",{met_id:4,libelle:"Salade de Chèvre Chaud",famille_id:4});mets.add(met);met.save();
var met = …Run Code Online (Sandbox Code Playgroud) 我想允许我的用户打开我们的应用程序(如果已安装,否则重定向到App Store应用程序页面),每当用户点击我们网站的网址时.
我发现Universal Links是从iOS-9开始实现上述要求的一种方式.我也知道Web服务器和Apple Developer门户要涵盖的要点.
唯一的问题是如何在Appcelerator Titanium app中启用Associated Domains?
提前感谢任何线索或帮助.