我正在优化我的应用程序并想知道对象的大小是多少,所以我也可以在日志中显示它.
假设我有
NSDictionary *temp=(NSDictionary*)[Data objectAtIndex:i];
//data is defined in the .h file
Run Code Online (Sandbox Code Playgroud)
现在我怎么知道对象temp的大小是多少.
我尝试使用变量视图,在temp部分中我发现了instance_size =(long int)30498656
instance_size是我临时对象的确切大小吗?
我也试过了
sizeof(temp);
Run Code Online (Sandbox Code Playgroud)
但它在那一点上崩溃了.任何帮助......
我很困惑,什么时候使用自我和这在JavaScript中.
我知道这是指当前的上下文,而self指的是当前窗口.
当我在Titanium中开发应用程序时.我想知道何时使用自我或者这个
或者确实在钛开发中有任何自我概念.
这是我在钛commonJS模块中执行的示例代码
var auth = require('/SDKTest/auth');
var nodeAPI = require('/SDKTest/nodeAPI');
function myAPI() {
this.auth = auth;
this.nodeAPI = nodeAPI;
return this;
}
module.exports = myAPI;
Run Code Online (Sandbox Code Playgroud)
此代码的工作,但我可以用自己代替这个?而不是使用这个,我可以创建一个命名空间,并做这样的事情:
function myAPI() {
var api = {};
api.auth = auth;
api.nodeAPI = nodeAPI;
return api;
}
Run Code Online (Sandbox Code Playgroud)
这两种方法都有效,但在这里使用它的用途是什么
我想构建一个iOS模块,其中我有一个带有.xib文件的viewController类.现在的问题是如何从我的钛代码中调用该视图.我知道有可用的视图代理,但由于文档不太好而不知道如何使用它们.
到目前为止我已经创建了一个可以传递非图形数据的模块,但是从我的模块中获取View控制器呢.
我已经检查了appcelerator wiki,但这没有用.任何指导我的教程都会有所帮助
titanium appcelerator appcelerator-mobile titanium-modules titanium-mobile
我是钛的新手,想从我的钛应用程序中调用一个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
我正在尝试为Xcode创建自动构建.直到现在一切正常.为了从命令行构建项目,我使用此命令
xcodebuild –project {“xcode_project file path”}–target {“target_name”} –sdk iphoneos –
configuration Release clean build CODE_SIGN_IDENTITY={$distribution_signing Identity}
PROVISIONING_PROFILE={UUID for provisioning profile}
Run Code Online (Sandbox Code Playgroud)
我想动态获取UUID和CODE_SIGN_IDENTITY,
对于我正在做的UUID
UUID=$(grep "<key>UUID</key>" "$PROVISIONING_PROFILE_PATH" -A 1 --binary-files=text | sed -E -e "/<key>/ d" -e "s/(^.*<string>)//" -e "s/(<.*)//")
Run Code Online (Sandbox Code Playgroud)
上面的脚本代码为我提供了任何配置文件的UUID.
我坚持动态获取CODE_SIGN_IDENTITY.我知道它的形式是这样的iPhone Distribution: Developer name
如何iPhone Distribution: Developer name 从.p12文件中提取.
我正在开发一个项目,我需要加密我存储在.plist文件中的数据,并希望将加密数据发送到我的webServices.我想知道iOS中是否有任何框架可以帮助我实现加密.
我听说iOS会自动在其级别进行一些加密.
和.net一样,我们预先写了RSA和其他加密库,我们在iOS中有相同的吗?
我正在开发一个基于Tab Bar的应用程序,我有一个带有.xib的A类和带有.xib的B类
在A类中,我正在加载B类的多个实例.
即在A级,我在做.
在.m文件中
-(void)renderData:(NSArray *)Data
{
for(int i=0;i<[Data count];i++)
{
B *grid=[[B alloc]initWithNibName:@"Beta" bundle:[NSBundle mainBundle]];
.
.
. //do something with the grid object i.e assign new image etc..)
[self.myGrid addObject:grid]; //i have a NSMutableArray myGrid declared in .h
[grid release];
}
}
Run Code Online (Sandbox Code Playgroud)
现在在myGrid数组中,我保存了网格的所有对象.
现在我将它们添加到Aplha类视图中.
for(int i=0;i<[myGrid count];i++)
{
B *grid1=[[myGrid objectAtIndex:i]retain]; //i have done this retain because when i try to come back to this tab or try to call the same function it crashes by saying …Run Code Online (Sandbox Code Playgroud) 我对在Objective-C中分配内存的正确方法感到困惑.假设我有一个NSMutableDictionary.我可以通过两种方式初始化它:
NSMutableDictionary *alpha = [[NSMutableDictionary alloc] init];
Run Code Online (Sandbox Code Playgroud)
要么
NSMutableDictionary *alpha = [NSMutableDictionary dictionary];
Run Code Online (Sandbox Code Playgroud)
他们之间有什么区别?我知道第一个为alpha分配内存,但第二个呢?
建议将哪一项作为分配内存的最佳做法?
嗨我正在使用Appcelerator构建iOS应用程序,
我有一个文件app.js和一个文件webService.js
webService.js文件包含一个 function x
现在从我的app.js文件我想调用
文件中function x存在的webService.js.
我搜索了很多,但我只发现使用html..i我没有使用任何HTML,它只是纯粹的JavaScript.
我正在使用jQuery移动框架在phonegap中创建一个应用程序.
在我的index.html文件中,我有两个文本框来接受用户名和密码.
当我点击提交按钮时,它调用一个函数submitBtn()来检查用户名和密码是否正确,如果它是正确的,那么它应该加载一个我创建的新的html文件`selectOption.html'
这是我的代码
<script type="text/javascript">
$(document).ready(function() {
var userName;
var userPassword;
$("#submitBtn").click(function() {
//alert("HI");
userName = $("#UserName").val();
userPassword = $("#Password").val();
if ((!UserName)|| (!userPassword)) {
alert("Enter the Details");
}
else {
if ((userName !="alpha") ||(userPassword !="beta")) {
alert('Enter correct username and password');
}
else {
//here i want to load my selectOption.html file ?
}
}
});
});
</script>
Run Code Online (Sandbox Code Playgroud)
我的代码<body>是
<body>
<div data-role="page" id="home">
<div data-role="header">
<h1>Enter Credential</h1>
</div>
<div data-role="content">
<label for="UserName">User Name</label> …Run Code Online (Sandbox Code Playgroud) 我被这个问题困住了,我正在调用一个返回 json 响应的 webService。
现在我想从那个响应中获取一个特定的值,但是在互联网上搜索并挣扎了很多之后无法修复它。
这是我的代码:
var xhr = Titanium.Network.createHTTPClient({
onload : function(e) {
Ti.API.info("Received text: " + this.responseText);
alert('success');
},
// function called when an error occurs, including a timeout
onerror : function(e) {
Ti.API.debug(e.error);
alert('error');
},
timeout : 5000
});
var data = {"data":"system.connect"};
xhr.open("POST","http://mytesturl.net/services/json");
xhr.setRequestHeader("Content-Type", "application/x-www-form-urlencoded; charset=utf-8");
xhr.send("method=system.connect");
Run Code Online (Sandbox Code Playgroud)
响应是这样的:
{"#error":false,"#data":{"sessid":"c4likn6vg33hngbpmobisrsbpcjjmf39","user":{"uid":0,"hostname":"102.119.85.120","roles":{"1":"anonymous user"},"session":"","cache":0}},"#response_code":200}
Run Code Online (Sandbox Code Playgroud)
从上面的响应中我想获取sessid值。什么是正确的方法?
javascript ×5
titanium ×5
appcelerator ×4
iphone ×4
objective-c ×4
ios ×2
ios4 ×2
xcode ×2
cocoa-touch ×1
cordova ×1
encryption ×1
jenkins ×1
jquery ×1
json ×1
xcode4.5 ×1
xcodebuild ×1