Quantcast
Channel: Appcelerator Developer Center Q&A Unanswered Questions 20
Viewing all 8068 articles
Browse latest View live

Connect to FTP server via TLS

$
0
0

Good Day, I'm having trouble uploading an image to a FTP server via TLS on Android 4.4 with Titanium SDK 3.4.0.GA. I'm able to connect to the server, but that's as far as i've gotten. After it connects, when I try to log into the server, I get the following message: [INFO] : Received: 550 TLS handshake failed What is going wrong? Here is my code: [App.js]

var mediaFileToUpload = '';
 
var win = Titanium.UI.createWindow({backgroundColor:'white'});
 
var connectButton = Titanium.UI.createButton({
title:'Connect',
top: 155,
left:30,
right:30,
height:40
});
win.add(connectButton);
var upB = Titanium.UI.createButton({
title:'upload',
top: 195,
left:30,
right:30,
height:40
});
win.add(upB);
upB.addEventListener('click', function(e){
    logout();
});
var controlSocket = Ti.Network.Socket.createTCP({
host:'xxx.xxx.xxx.xxx',
port:'21',
stripTerminator:true,
mode:Titanium.Network.READ_WRITE_MODE,
connected: function(e) { Ti.API.info("Connected to xxx.xxx.xxx.xxx"); tryToConnect();},
});
 
function tryToConnect() {
    Ti.API.info("Trying to connect with SSL");
    Ti.Stream.pump(controlSocket, readCallback, 1024, true);
    Ti.Stream.write(controlSocket, Ti.createBuffer({
        value: 'AUTH SSL\r\n'
    }), writeCallback);
    Ti.API.info("SSL succeeded!");
    Ti.API.info("PBSZ Stuff"); // right here is where it fails.
    Ti.Stream.pump(controlSocket, readCallback, 1024, true);
    Ti.Stream.write(controlSocket, Ti.createBuffer({
        value: 'PBSZ 0\r\n\r\n'
    }), writeCallback);
    Ti.API.info("Entered PBSZ");
    Ti.API.info("Logging in");
    Ti.Stream.pump(controlSocket, readCallback, 1024, true);
    Ti.Stream.write(controlSocket, Ti.createBuffer({
        value: 'USER [user]\r\n'
    }), writeCallback);
    Ti.API.info("User Entered");
    Ti.API.info("Password:");
    Ti.Stream.pump(controlSocket, readCallback, 1024, true);
    Ti.Stream.write(controlSocket, Ti.createBuffer({
        value: 'PASS [password]\r\n'
    }), writeCallback);
    Ti.API.info("Password Entered");
    Ti.API.info("Logged in and ready to use server!");
    Ti.API.info("Changing to /smcapp directory...");
    Ti.Stream.pump(controlSocket, readCallback, 1024, true);
    Ti.Stream.write(controlSocket, Ti.createBuffer({
        value: 'CWD /smcapp\r\n'
    }), writeCallback);
    Ti.API.info("Changed to /smcapp directory");
    Ti.API.info("Entering Passive mode...");
    Ti.Stream.pump(controlSocket, readCallback, 1024, true);
    Ti.Stream.write(controlSocket, Ti.createBuffer({
        value: 'PASV\r\n'
    }), writeCallback);
    Ti.API.info("Entered Passive mode");
    Ti.API.info("Sending File to server...");
    Ti.Stream.pump(controlSocket, readCallback, 1024, true);
    Ti.Stream.write(controlSocket, Ti.createBuffer({
        value: 'STOR ' + Ti.Filesystem.applicationDataDirectory + '/' + 'Image2.png' + '\r\n'
    }), writeCallback);
    Ti.API.info('Sent File to server.');
    Ti.API.info('Checking mediaFileToUpload...');
    Ti.API.info('mediaFileToUpload = ' + mediaFileToUpload);
    //logout();
    //upload(e); 
}
function readCallback(e) { 
    if (e.bytesProcessed == -1) { // Error / EOF on socket. Do any cleanup here. 
 
        Ti.API.error('something went wrong' + e.buffer.toString());
    }
    try { 
                if (e.buffer) { 
                    var received = e.buffer.toString(); 
                    Ti.API.info('Received: ' + received); 
                    }
            }
            catch (er)
            {
 
            }
 
    }
function writeCallback(e) { Ti.API.info('Successfully wrote to socket.'); }
controlSocket.addEventListener('readError', function(e) {
Titanium.API.info('Socket read error: ' + e.error);
});
 
controlSocket.addEventListener('writeError', function(e) {
Titanium.API.info('Socket write error: ' + e.error);
});
 
function logout()
{
    try {
    Titanium.API.info('[CLIENT] Quitting');
    Ti.Stream.pump(controlSocket, readCallback, 1024, true);
    Ti.Stream.write(controlSocket, Ti.createBuffer({
        value: 'QUIT\r\n'
    }), writeCallback);
    Ti.API.info('221 Goodbye.');
    }
    catch (ex)
    {
        Ti.API.error('Failed to logout. Error: ' + ex.toString());
    }
    //connectButton.title = 'Connect';
}
 
connectButton.addEventListener('click', function(){
//if (connectButton.title == 'Connect') {
    try {
        //Titanium.API.info('[CLIENT] Connecting to ' + controlSocket.host);
        //controlSocket.connect();
        //connectButton.title = 'Disconnect';
        //connectButton.title = 'Disconnect';
        upload();
    } catch (e) {
        Titanium.API.info('Error: ' + e.error);
    }
//} else {
 
//}   
});
 
function upload()
{
    Titanium.Media.showCamera({
        success:function(event){
            if (event.mediaType == Ti.Media.MEDIA_TYPE_PHOTO) {
                var errorMessage = 'unknown [default] (or no problems!)';
                    var path = Ti.Filesystem.getApplicationDataDirectory();
                    var aFile = Ti.Filesystem.getFile(path, 'Image2.png');
                    mediaFileToUpload = aFile.getNativePath();
                    aFile.write(event.media);
                    Ti.API.info(aFile.nativePath + "     = fx.nativePath");
                    Ti.API.info(aFile.name + "    = fx.name");
                    Ti.API.info('connecting to server 208.109.104.197');
                    controlSocket.connect();
                    try {
                    }
                    catch (exe)
                    {
                        errorMessage = "Failed to Log out.";
                    }
                alert('failed to send file to smc national. error: ' + errorMessage);
            }
            else {
                alert("Please take a picture, not a video");
            }
        },
        cancel:function(event){
 
        },
        error:function(event){
            alert("An Error Occured. Sorry.");
        },
    });
 
}

Chunk File Upload With Php

$
0
0

Hi All

One issue that i have come across quite a lot with the titanium framework and especially android is outofmemory and i have other posts on the forum and the solution is definitely chunk file upload management.

I am sure this would benefit a lot of other titanium users being able to do this, i am looking for a example and people to help out in the community building a example of chunk file upload with php.

So here is what i have so far from code around the web i have a snippet i have a titanium http upload example below

var chunk_size = 1024 * 1024; // 1Kb * 1024 = 1MB
var chunk_no = 10; // Which chunk we want
var file = Ti.Filesystem.getFile( 'file.mp4' );
var stream = file.open( Ti.Filesystem.MODE_READ );
 
// Scrub through the stream till we're up to the part we need
for (i = 0; i < chunk_no; i++) {
    var buffer = Ti.createBuffer({length: chunk_size});
    // This reads chunk_size bytes from where it left of in the last loop, puts it at the start of the buffer
    var bytes_read = stream.read( buffer, 0, chunk_size );
 
    // Ti.API.info('bytes_read: '+bytes_read);
 
    // If it's not the chunk we want, release the buffer memory
    if (i < chunk_no) {
        buffer.release();
        buffer = null;
    }
}
// This now contains the chunk we want
var blob = buffer.toBlob();
So i take it this needs to be wrapped around a http client upload maintaining connection.

Now i have been looking around the web for examples of a php script that handles chunk file upload and i have used pluploader in the past and i know this handles chunk file upload the php script is below.

<?php
/**
 * upload.php
 *
 * Copyright 2013, Moxiecode Systems AB
 * Released under GPL License.
 *
 * License: http://www.plupload.com/license
 * Contributing: http://www.plupload.com/contributing
 */
 
#!! IMPORTANT: 
#!! this file is just an example, it doesn't incorporate any security checks and 
#!! is not recommended to be used in production environment as it is. Be sure to 
#!! revise it and customize to your needs.
 
 
// Make sure file is not cached (as it happens for example on iOS devices)
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");
header("Cache-Control: no-store, no-cache, must-revalidate");
header("Cache-Control: post-check=0, pre-check=0", false);
header("Pragma: no-cache");
 
/* 
// Support CORS
header("Access-Control-Allow-Origin: *");
// other CORS headers if any...
if ($_SERVER['REQUEST_METHOD'] == 'OPTIONS') {
    exit; // finish preflight CORS requests here
}
*/
 
// 5 minutes execution time
@set_time_limit(5 * 60);
 
// Uncomment this one to fake upload time
// usleep(5000);
 
// Settings
$targetDir = ini_get("upload_tmp_dir") . DIRECTORY_SEPARATOR . "plupload";
//$targetDir = 'uploads';
$cleanupTargetDir = true; // Remove old files
$maxFileAge = 5 * 3600; // Temp file age in seconds
 
 
// Create target dir
if (!file_exists($targetDir)) {
    @mkdir($targetDir);
}
 
// Get a file name
if (isset($_REQUEST["name"])) {
    $fileName = $_REQUEST["name"];
} elseif (!empty($_FILES)) {
    $fileName = $_FILES["file"]["name"];
} else {
    $fileName = uniqid("file_");
}
 
$filePath = $targetDir . DIRECTORY_SEPARATOR . $fileName;
 
// Chunking might be enabled
$chunk = isset($_REQUEST["chunk"]) ? intval($_REQUEST["chunk"]) : 0;
$chunks = isset($_REQUEST["chunks"]) ? intval($_REQUEST["chunks"]) : 0;
 
 
// Remove old temp files    
if ($cleanupTargetDir) {
    if (!is_dir($targetDir) || !$dir = opendir($targetDir)) {
        die('{"jsonrpc" : "2.0", "error" : {"code": 100, "message": "Failed to open temp directory."}, "id" : "id"}');
    }
 
    while (($file = readdir($dir)) !== false) {
        $tmpfilePath = $targetDir . DIRECTORY_SEPARATOR . $file;
 
        // If temp file is current file proceed to the next
        if ($tmpfilePath == "{$filePath}.part") {
            continue;
        }
 
        // Remove temp file if it is older than the max age and is not the current file
        if (preg_match('/\.part$/', $file) && (filemtime($tmpfilePath) < time() - $maxFileAge)) {
            @unlink($tmpfilePath);
        }
    }
    closedir($dir);
}   
 
 
// Open temp file
if (!$out = @fopen("{$filePath}.part", $chunks ? "ab" : "wb")) {
    die('{"jsonrpc" : "2.0", "error" : {"code": 102, "message": "Failed to open output stream."}, "id" : "id"}');
}
 
if (!empty($_FILES)) {
    if ($_FILES["file"]["error"] || !is_uploaded_file($_FILES["file"]["tmp_name"])) {
        die('{"jsonrpc" : "2.0", "error" : {"code": 103, "message": "Failed to move uploaded file."}, "id" : "id"}');
    }
 
    // Read binary input stream and append it to temp file
    if (!$in = @fopen($_FILES["file"]["tmp_name"], "rb")) {
        die('{"jsonrpc" : "2.0", "error" : {"code": 101, "message": "Failed to open input stream."}, "id" : "id"}');
    }
} else {    
    if (!$in = @fopen("php://input", "rb")) {
        die('{"jsonrpc" : "2.0", "error" : {"code": 101, "message": "Failed to open input stream."}, "id" : "id"}');
    }
}
 
while ($buff = fread($in, 4096)) {
    fwrite($out, $buff);
}
 
@fclose($out);
@fclose($in);
 
// Check if file has been uploaded
if (!$chunks || $chunk == $chunks - 1) {
    // Strip the temp .part suffix off 
    rename("{$filePath}.part", $filePath);
}
 
// Return Success JSON-RPC response
die('{"jsonrpc" : "2.0", "result" : null, "id" : "id"}');
What i am trying to do (and failing) is to get these two to work together so i can handle chunk file upload within my apps helping out loads with memory issues.

Can anyone help me...

Upgrading to Facebook Graph API 2.0?

$
0
0

Hello, I've noticed that when I login to my app via Facebook Login, Im getting prompted to upgrade from Graph 1.0 to Facebook Graph API 2.0.

From what I know, there's not possible in Titanium to do this upgrade, right now?

Am I wrong? Have I missed it somewhere?

Oh, Im developing a iPhone App in Ti 3.4.

Status Bar background color issue

$
0
0

I have upgraded titanium from 3.1.3 to 3.4.1 to make my application work on iphone 6. After upgrading its shows me black status bar. I have already searched the forum but could not able to get the results which I want.

All the question which were listed tells to change the text color of status bar. I want to make status bar same as it was before like grey background and black text color.

Hope I explained it well. Waiting for the response. Thank you

xcode 6.01 - Where did the device/simulator logs go?

$
0
0

I swear I used to be able to go to the device window and see the logs for the simulator but now all I see is in the picture attached... Some articles said there is an arrow that needs to be clicked but I dont have that on my screen.

http://tinypic.com/r/24kxnah/8

Any ideas?

Thanks,

David

Android Error

$
0
0

i have a function with a tableview when i press a button, made a action in all rows in tableview. the problem is when total of rows is more than 3 throws me next error and application close:

[WARN] :   dalvikvm: Last 10 entries in JNI local reference table:
[WARN] :   dalvikvm:   502: 0xb6717ae0 cls=Lti/modules/titanium/ui/TableViewRowProxy; (108 bytes)
[WARN] :   dalvikvm:   503: 0xb68af918 cls=Lti/modules/titanium/ui/TableViewRowProxy; (108 bytes)
[WARN] :   dalvikvm:   504: 0xb67b3b78 cls=Lti/modules/titanium/ui/TableViewSectionProxy; (108 bytes)
[WARN] :   dalvikvm:   505: 0xb676bca8 cls=[Lti/modules/titanium/ui/TableViewRowProxy; (52 bytes)
[WARN] :   dalvikvm:   506: 0xb692fea8 cls=Lti/modules/titanium/ui/TableViewRowProxy; (108 bytes)
[WARN] :   dalvikvm:   507: 0xb6c109d8 cls=Lti/modules/titanium/ui/TableViewRowProxy; (108 bytes)
[WARN] :   dalvikvm:   508: 0xb68b71a0 cls=Lti/modules/titanium/ui/TableViewRowProxy; (108 bytes)
[WARN] :   dalvikvm:   509: 0xb6b427a8 cls=Lti/modules/titanium/ui/TableViewRowProxy; (108 bytes)
[WARN] :   dalvikvm:   510: 0xb69764a8 cls=Lti/modules/titanium/ui/TableViewRowProxy; (108 bytes)
[WARN] :   dalvikvm:   511: 0xb6707498 cls=Lti/modules/titanium/ui/TableViewRowProxy; (108 bytes)
[WARN] :   dalvikvm: JNI local reference table summary (512 entries):
[WARN] :   dalvikvm:    19 of Lti/modules/titanium/ui/TextFieldProxy; 100B (8 unique)
[WARN] :   dalvikvm:     2 of Lti/modules/titanium/ui/TextFieldProxy; 108B (1 unique)
[WARN] :   dalvikvm:    21 of Lti/modules/titanium/ui/LabelProxy; 100B (9 unique)
[WARN] :   dalvikvm:    55 of Lti/modules/titanium/ui/TableViewSectionProxy; 108B (1 unique)
[WARN] :   dalvikvm:     1 of [Lti/modules/titanium/ui/TableViewRowProxy; 52B
[WARN] :   dalvikvm:    21 of Lti/modules/titanium/ui/ButtonProxy; 100B (9 unique)
[WARN] :   dalvikvm:   393 of Lti/modules/titanium/ui/TableViewRowProxy; 108B (9 unique)
[WARN] :   dalvikvm: Memory held directly by tracked refs is 3840 bytes
[INFO] :   dalvikvm: "KrollRuntimeThread" prio=5 tid=8 RUNNABLE
[ERROR] :  dalvikvm: Failed adding to JNI local ref table (has 512 entries)
[INFO] :   dalvikvm:   | group="main" sCount=0 dsCount=0 obj=0xb65a62c0 self=0x9163ec8
[INFO] :   dalvikvm:   | sysTid=1775 nice=0 sched=0/0 cgrp=[fopen-error:2] handle=152453104
[INFO] :   dalvikvm:   at org.appcelerator.kroll.runtime.v8.V8Object.nativeFireEvent(Native Method)
[INFO] :   dalvikvm:   at org.appcelerator.kroll.runtime.v8.V8Object.fireEvent(V8Object.java:62)
[INFO] :   dalvikvm:   at org.appcelerator.kroll.KrollProxy.doFireEvent(KrollProxy.java:884)
[INFO] :   dalvikvm:   at org.appcelerator.kroll.KrollProxy.handleMessage(KrollProxy.java:1107)
[INFO] :   dalvikvm:   at org.appcelerator.titanium.proxy.TiViewProxy.handleMessage(TiViewProxy.java:347)
[INFO] :   dalvikvm:   at android.os.Handler.dispatchMessage(Handler.java:95)
[INFO] :   dalvikvm:   at android.os.Looper.loop(Looper.java:130)
[INFO] :   dalvikvm:   at org.appcelerator.kroll.KrollRuntime$KrollRuntimeThread.run(KrollRuntime.java:112)
[INFO] :   dalvikvm:
[ERROR] :  dalvikvm: VM aborting
what is this error? memory leak?

Android version of app crashing

$
0
0

I am trying to figure out why my app crashes. This only happens when I bump the SDK up to 3.3.0 or higher.

[WARN] : dalvikvm: threadid=1: thread exiting with uncaught exception (group=0x415cbba8) [ERROR] : TiApplication: (main) [851,5830] Sending event: exception on thread: main msg:java.lang.NullPointerException; Titanium 3.4.1,2014/11/13 13:33,5982e8f [ERROR] : TiApplication: java.lang.NullPointerException [ERROR] : TiApplication: at org.appcelerator.titanium.proxy.TiViewProxy.handleMessage(TiViewProxy.java:316) [ERROR] : TiApplication: at android.os.Handler.dispatchMessage(Handler.java:98) [ERROR] : TiApplication: at android.os.Looper.loop(Looper.java:136) [ERROR] : TiApplication: at android.app.ActivityThread.main(ActivityThread.java:5017) [ERROR] : TiApplication: at java.lang.reflect.Method.invokeNative(Native Method) [ERROR] : TiApplication: at java.lang.reflect.Method.invoke(Method.java:515) [ERROR] : TiApplication: at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:779) [ERROR] : TiApplication: at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:595) [ERROR] : TiApplication: at dalvik.system.NativeStart.main(Native Method)

I don't understand this error log.

List all WiFi connected devices

$
0
0

Hi,

I need to develop an application that requires listing out all the devices [iphone/ipad/Mac] that are in the current local wifi network. Can any body point me to a sample tutorial on this. Is it possible to list out devices in lcoal wifi network using Bonjour?

Thank you Rush


SAXParseException occurs with only Android

$
0
0

Hi all,

I got this error with running my app in Android device. This does not happen in iPhone. What is the problem and how can I fix it??

[ERROR] :  XMLModule: (KrollRuntimeThread) [7103,430789] Error parsing XML
[ERROR] :  XMLModule: org.xml.sax.SAXParseException: attr value delimiter missing! (position:START_TAG <div class='loader' align='onClickConfirmCommentButton(' + commentID + ')'>@141:57 in java.io.InputStreamReader@5377c230)
[ERROR] :  XMLModule:   at org.apache.harmony.xml.parsers.DocumentBuilderImpl.parse(DocumentBuilderImpl.java:146)
[ERROR] :  XMLModule:   at javax.xml.parsers.DocumentBuilder.parse(DocumentBuilder.java:107)
[ERROR] :  XMLModule:   at ti.modules.titanium.xml.XMLModule.parse(XMLModule.java:82)
[ERROR] :  XMLModule:   at ti.modules.titanium.network.TiHTTPClient.getResponseXML(TiHTTPClient.java:697)
[ERROR] :  XMLModule:   at ti.modules.titanium.network.HTTPClientProxy.getResponseXML(HTTPClientProxy.java:107)
[ERROR] :  XMLModule:   at org.appcelerator.kroll.runtime.v8.V8Object.nativeCallProperty(Native Method)
[ERROR] :  XMLModule:   at org.appcelerator.kroll.runtime.v8.V8Object.callProperty(V8Object.java:73)
[ERROR] :  XMLModule:   at org.appcelerator.kroll.KrollProxy.handleMessage(KrollProxy.java:1121)
[ERROR] :  XMLModule:   at android.os.Handler.dispatchMessage(Handler.java:95)
[ERROR] :  XMLModule:   at android.os.Looper.loop(Looper.java:137)
Thank you.

ACS Push Log Length Limit

$
0
0

Both the push logs showed in production and development mode is limited to 10 rows only, the oldest log is removed automatically when new one arrives. Is it a limited for free tier?

xtouch X716s Camera Issue

$
0
0

Error Opening camera driver... Facing this issue after hard resetting the tablet

Get ip address from bonjour device

$
0
0

Hi community,

does anybody have a working example of how to read the ip address or TXTRecordData from a service fetched by a bonjour browser?

My problem as follows: I need to browse for a service, what is really simple. That works from the scratch. But as I have found a service, I have to read the ip address and the TXTRecordData from it. And here it ends at it seems.

This is a log of my service:

[INFO] [iphone, 8.1, undefined] service.domain: local. [INFO] [iphone, 8.1, undefined] service.name: Project XGW3000 [INFO] [iphone, 8.1, undefined] service.socket: undefined [INFO] [iphone, 8.1, undefined] service.type: _project._tcp.

Here is a pastie of my code: http://pastie.org/private/aphfwv04ebqivtxpszhqq

My search in the community questions return only a whole number of question with no answers. So all my hope lays on the titans now. Any help is appreciated!

Can I use AngularJs for implementing Dependency Injection in my application?

$
0
0
  1. Is this possible at all? Has this been tried before? Are there any other ways to implement DI in Titanium?
  2. What is the application seem in a Titanium Application which is the most appropriate place to bootstrap IOC and how? (I'm thinking the composition root should be in app.js)
  3. What are the implications of having DI implemented in a Ti App considering dependency lifetime management? i.e. possible performance/memory concerns, etc.

What I'd really like to do is to register platform specific implementations of a dependency in the composition root rather than having "if platform == android / ios" checks everywhere in code. This would ideally limit the platform checks to the composition root. Rather than DI, is there any other way to do it?

widget support in listview

$
0
0

hi, Are custom widgets planned to be supported with Listview?

Am currently using latest version of alloy from Github. Get an error during compile time when I add a custom widget to my template section in ListView.

Thanks.

The network connection was lost.

$
0
0

Hi,

When I hit the below url

https://maps.googleapis.com/maps/api/place/autocomplete/json?input=hkj&components=country:gb&sensor=true&key=AIzaSyDW17njzyRkeCkpDjbvIMSZGNcioniphYo

I am getting following error on Titanium SDK 3.3.0

[INFO] : code = "-1005"; [INFO] : error = "The network connection was lost."; [INFO] : source = "[object TiNetworkHTTPClient]"; [INFO] : success = 0; [INFO] : type = error; Same url is working on Titanium SDK 3.1.3

Other url's are working fine with both SDK's


iOS Simulators missing

$
0
0

Hi all,

I'm trying to port an old application to the new iOS8, due to compatibility issues requested by users. The app was developed with Titanium Studio and is on the stores since end 2011 and I have not updated it since january 2012. In the last days decided to reinstall Titanium on Mac, updated to 3.4 beta with some trouble (now 3.4 stable), installed xcode 6.01.

Surprisingly I did not have hard troubles making the old app work on my real device, but it seems that I made a mess with installation because if I select the last sdk I loose all the simulators output. They are simply not present in the menu next to "Run" command. The simulators are present if the sdk 3.3 is selected but they don't output anything, throwing out an error (and this is somehow expected since it wasn't working with xcode 6).

For completeness, the xcode 6 simulators are perfectly working with other frameworks or from xcode tools.

These are the console logs:

SDK 3.4GA with simulator forced run from "Run Configuration" menu:

Titanium Command-Line Interface, CLI version 3.4.0, Titanium SDK version 3.4.0.GA
Copyright (c) 2012-2014, Appcelerator, Inc.  All Rights Reserved.
Please report bugs to http://jira.appcelerator.org/
Available iOS Simulators:
8.0
  B74F99B5-C116-425B-9454-930E2B83146C  iPhone 4s
  1F146D6F-81A0-4C59-87E3-D84419091032  iPhone 5
  5C80A4C0-2D60-41DE-A7F9-0ED6D242D811  iPhone 5s
  8CE907D3-473D-486D-AC40-44648C208F1C  iPhone 6 Plus
  CEFD692C-2B9A-47DB-A4B6-964589EB559B  iPhone 6
  EACBC71A-385F-4336-AF3E-5A0288BA5BC6  iPad 2
[ERROR] :  Invalid "--device-id" value "iPad"
  5C0143FE-CDE8-42F4-8860-C6CC33F58B5C  iPad Retina
  495B2271-FA7C-4196-A9C4-EAA308696FF0  iPad Air
  246D32C1-A771-4629-9CC5-FCD70A1DCDB3  Resizable iPhone
  6D5DB6A1-73EF-4849-B6F6-A38A2B99A9B4  Resizable iPad
7.0.3
  04B03946-5C55-46AE-9286-37726B480ED0  iPhone 4s
  795B992C-9530-4B0F-A410-BB8E20372F78  iPhone 5
  160F25F3-638C-49EF-9868-9722FEB7D703  iPhone 5s
  4304B930-7FD3-486E-91ED-BCB536075F55  iPad 2
  8CB96EE2-9FD2-4B5D-8AB5-D2240A75DFEA  iPad Retina
  6A9B2D70-3194-45ED-BB4A-87CF68347331  iPad Air
For help, run: titanium help build

SDK 3.3GA with simulator selected from standard menu:

Titanium Command-Line Interface, CLI version 3.4.0, Titanium SDK version 3.3.0.GA
Copyright (c) 2012-2014, Appcelerator, Inc.  All Rights Reserved.
Please report bugs to http://jira.appcelerator.org/
[ERROR] :  There are no supported Xcode installations found.
Should I reinstall everything? I just tried to delete and reinstall Studio but it seems that something remains in the Mac and the problem is the same. How can I make a TRUE CLEAN reinstall of Titanium, mobile sdk's and any other sensible file?

Thanks

Node ACS remember me option when login

$
0
0

Hi.

I was trying to do an login option for my ACS web site so user can mark it and don't need to login each time he closes the browser. I did some searchs and found some close questions to this, but almost all was for mobile apps, no for Node ACS.

Well, what I tried till now was to login initially and save the data.meta.session_id into a cookie (with a week expiration time):

ACS.Users.login({
        // Get fields from form
        login: req.body.username,
        password: req.body.password
    }, function(data) {
        if (data.success) {
                // Set session data to be used later througout the app
                req.session.session_id = data.meta.session_id;
                res.cookie('session', req.session.session_id, {maxAge:60*60*24, httpOnly: true});
        } else { 
            res.redirect('/error?type=1');
        }
    });
Then, when the user closes the browser I still have the session alive in the cookie. When he comes back I do this:
if (req.cookies.session) {
        req.session.session_id = req.cookies.session;
}
Which seems valid, but now I need to access my user data and when I try this I get an error:
var ACS = require('acs').ACS;
        ACS.sessionId = req.cookies.session;
        ACS.Users.showMe(function (e) {
            if (e.success) {
                var user = e.users[0];
                console.log('Success:\n' +
                    'id: ' + user.id + '\n' +
                    'first name: ' + user.first_name + '\n' +
                    'last name: ' + user.last_name);
            } else {
                console.log('Error:\n' +
                    ((e.error && e.message) || JSON.stringify(e)));
            }
        });
 
Error: You need to sign in or sign up before continuing
How can I access my user data? Or this is not a valid method? Any other way to recover the user session to avoid continuosly login in?

How to hide a - or alternative for form layout?

$
0
0

Ok, this is (or ought to be) straightforward - unless I am overlooking something (which probably is the case).

I have created a very simple example:

index.xml

<Alloy>
        <Window>
            <TableView>
                <TableViewSection>
                    <TableViewRow>
                        <Label>Row 1</Label>
                    </TableViewRow>
                    <TableViewRow visible="false">
                        <Label>Row 2</Label>
                    </TableViewRow>
                    <TableViewRow id="row3">
                        <Label>Row 3</Label>
                    </TableViewRow>
                </TableViewSection>
            </TableView>
        </Window>
    </Alloy>
... and index.tss:
"#row3":{visible:false}
 
    "Window": {
        top: 60
    }
I would have expected that row 2 and row 3 were NOT displayed. However, all rows display (in the iOS Simulator).

I have read about similar issues in earlier versions of Titanium Studio. The workaround from these 2-4 years old posts were to set the height of the tableviewrow to 1 (as 0 is ignored). However, this still shows part of the label. Then I can hide the label (visible="false" workst for that!) and then I only see a "thin" row. But with the standard view row separators you still see that there is a row....

So, what am I doing wrong here??

I use the TableView layout to create a form for entering data - and some of the rows should only be shown to the user if a switch is set. Is there a better pattern for doing this?

I am on Studio 3.4.1GA, Mac OS X 10.10.1 and using the 8.1 iOS in simulator ;-)

Thank you in advance!

/John

Image on sony xperia z3

$
0
0

Why images added through imageViews appear small on sony experia z3?

Tableview click event not firing if table is edited and scrollable is false

$
0
0

I'm having problems with a tableview click event not firing if the table is edited, for example by adding a row, and if scrollable=false.

The following code is a simple example. If the user makes a longpress on a row, then a new row is added. After the row has been added, the first click event (on any row) will not work. A second click will work.

Does anyone have any ideas if I'm doing something wrong, or if there is a workaround?

var win = Ti.UI.createWindow({backgroundColor:'white'});
var table = Ti.UI.createTableView({top:20,scrollable:false});
var tableData = [];
 
// Create some rows
for (var i=0; i<5; i++) {
    var row = Ti.UI.createTableViewRow({title:'Row '+i,myName:'Row '+i});
    tableData.push(row);
}
 
// Add the rows to the table
table.setData(tableData);
 
// Duplicate a row when the user makes a long press, and add the new row to the bottom of the table
table.addEventListener('longpress',function(e){
    var rowData = table.data[0].rows;        
    rowData.splice(rowData.length,0,rowData[e.index]);
    table.setData(rowData);     
});
 
// Test the click event
table.addEventListener('click',function(e) {
    alert(e.source.myName+' clicked');
});
 
 
win.add(table);
win.open();
Viewing all 8068 articles
Browse latest View live


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>