The problem of Titanium

    咱们公司使用Appceletor公司的Titanium开发了公司的商业App,而且成功的在App store中发布,已经更新至1.1,如今,咱们决定更换使用原生的xcode与object-c,从新开发咱们的App. 所以,CTO要求我提供一份简单的文档,叙述咱们开发中遇到的问题,以方便他说服其余人. 我简单的写了些,列在这里,若是有人对Titanium感兴趣,能够读一下.git

    中国式的英文,应该还好懂,我就不翻译了.web

正文以下:xcode

Titanium is a mobile development platform for IOS and Android. Using it, you can develop the native applications under the syntax of JavaScript. app

We develop our application called Movoto for IOS in the Titanium Studio from March to now and now our first version V1.0 and updated version V1.1 for IPHONE have been published to the App Store and a new universal version has been finished nearly. In the whole development, we meet many questions these are listed below when we develop the IOS App.less

1, we can’t customize our popup view when the user clicks a pin on the map.dom

Our App is centered the map, and this is a very important function. The SDK of Titanium packages the basic functions of mapkit, it only offers a standard style for this: left image, title, sub title and right image. It is impossible if you want to define a view for this popup view.ide

At last, I hack the SDK and make this standard popup view disappear and then, record the clicked point to event. Then, in Titanium, when I catch the clicked event, I calculate the position and show a customized view. It’s OK but sometimes, this clicked point is (0,0) that’s a question we have not checked.flex

2, we can’t change the image of pins in Titanium if the pins have been added.ui

PM asks that the homes have different types, we should tag these types using different image of pins. I set the different images for different pins, but found that if I search homes again with the same condition, the second result shows the different image of pins but I have set the same image to pins. It is strange.  I read the API document of IOS and the code of Titanium and find that mapview of IOS creates a queue for its pins and if the developer wants to add a pin to the map, he should get a pin from this queue, update its property and then add it to the map. In the source code of Titanium, only when an annotation is created, the image is set. So, only the first time the mapview will show the right images. No way, I modify the SDK of Titanium and update the image of pins when it is added to the map.this

3, Shade of the view.

In the PRD of our IPAD App, there is a shade in the left of the view( The right part of the dpp). Titanium SDK is not supported shade of view and then, we add a function to the Titanium SDK to render.

4, combined-view

We have many combined views such as search bar, round rectangle with a white line. Because we have no “override” in the Titanium, we have to view nested view, and view is a heavy object – that makes the rendering slow.

5, lacking functions

The table object will show a delete button that comes from IOS Framework when the user glides on it. When the user clicks this button, this row will be removed. But in our application’s condition, we don’t want the row removed at that time until the deleting API returns true.

In the PRD of IPAD, there is a function if the user clicks the row on the left list, the popup view is shown on the right of map. But, we can’t get the position based the longitude and latitude, so we chose entering the dpp directly.

6, difficult debugging and evaluated performance

The debugging is very difficult in Titanium because you need find tools to debug JavaScript-that’s only debugging syntax, but JavaScript is a language lacking limited in syntax. If you forget to write a “var” that’s right in syntax, you never know why your app runs strange unless you check your code carefully. Besides, if your app crashes, you don’t know why even you have the crash report because this crash maybe is random, you don’t know where is crashed.

7, lacking document

It’s lacking in the document of Titanium, it has less code for  examples and some codes of examples run a wrong and some errors in the sdk such as TS’s Version, it said that the version is a number but string.

8, other factor

Titanium is a developing tool and it is published a new version nearly every month – To fix bugs or expand new features, and at the same time, IOS SDK is developing quickly and expanding new framework or change service such as passkit for passport, maps . After 2.0 is published, you have to modify your code to suit because it’s not completely compatible previous version especially UI. So we are using Titanium SDK 1.8.2 not the newer. We will use calendar, facebook, google analyse, twitter, but they all offer the native SDK and we have to find the replaced scheme in Titanium.

If you want to develop the native app in Titanium, you must follow all limited from Titanium and IOS framework – that means, many functions in IOS are not imported to Titanium such as gamekit, EventKit and so on, if you meet strange things when you are developing in Titanium, maybe you need research IOS SDK because it’s only a basic package such as mapkit. Sometimes, you want to develop a beautiful UI/function, you have to rack your brains how to combine in Titanium rather than overriding in the IOS simply. It feels very constrained for developers. So if you only want to get a basic business app and your developers mainly are in the front of web, it’s a good choice to use Titanium, but if you want to develop a good, high performance and flexible app, you’d better chose the native develop tools.