Titanium Mobile: TroubleShooting

The one thing I discovered while using Titanium Mobile, is that trouble shooting is always a pain in the ass. Seriously, most errors don't make any sense, and are not really helping you get to your solution.

I had to figure it out the hard way unfortunately. But, I discovered a lot of solutions which will help you get through most of the problems, considering you didn't really made an error in your code.

So let me get it clear. Your code doesn't build, but you think you did it the right way? Let me help you.

First of all, remove the build. The build can be found here: "Titanium Workspace > Your Project > Build"  and within that directory you'll find an android and/or an iPhone directory. Remove the contents of those directories (don't remove the directories themselves or you might get errors). Usually this method can be used when Titanium says it cannot find a module, and this error usually occurs when you did a build for a device (not emulator). When building for a device, Titanium strips away all unnecessary modules. So when you are using a module you haven't used before it will crash.

Secondly, if that didn't solve the problem, make sure your includes are working correctly. By default titanium should use the resources directory if you include like this:

1
Ti.include('/myfile.js');

But mainly on android these kinds of includes could give errors. The best way to fix this is to use the resources path location. Which would make this line:

1
Ti.include(Ti.Filesystem.resourcesDirectory+'myfile.js');

Note that I'm using Ti instead of Titanium. Ti is a synonym of Titanium and thus can be used like Titanium.

Next up, the error "File not found" in the debugging console in Titanium Studio. This error isn't really an issue of file not found, but it is an issue that there is an error in that file. Usually this is just a regular JavaScript error.

Should these fixes not fix your issue, let me know!

Ignore the “if it aint broke dont fix it” mentality

You, as a software developer, have probably heard of this phrase, “if it aint broke don’t fix it”. You probably also hate this, but usually this is a short term thing. Take a look at facebook for example. When v2 gets released, people want v1 back, because v1 was, in their eyes, better. But was it better? Usually it is not, but people have to get used to the new layout first. Then, after a couple of months v3 gets released. Guess what, people complain they want v2 back, because that version was better, but no-one will complain they want v1 back, because that one is old. Take a look at the image below, do you really want to get back to that (2007).

If you would take my advice, I would just ignore these people, don’t even pay attention to them. But take a really close look the the “I like it, but…” people. The other part, the people that just “love it” are no good feedback for you. The “but..” people are. Give them the attention.

Facebook in 2007

You will need to start looking into the future, and take usability. That’s the most important aspect of design. It has to be easy in use, and people should be able to understand everything without having to look up tutorials. It should speak for itself. Both Microsoft and Blackberry released demo videos about how they think the future will look like. Of course, usually it turns out completely different, but in general there is some truth in it. Both companies have the same image in their head, and I think a lot of people look at it like this.

Take a look again to the image above, what would you have changed about that? It looks way to cluttered right? Lots of buttons, links, texts and more in the smallest amount of space the designer could put it in. Now it’s turning around, like in the demo videos. More and more space is added in between compartments on a website, and still we are able to do the same thing. Some more examples following this guideline are for example this weblog (default wordpress theme) or the new gmail interface. Checked it out already? Take a look here.

Let me know what you think about it, and what you’ve done about restyling with more space. It does make sense right? Oh, and I added the video’s below, check them out!

Microsoft:

Blackberry:

Remember: Most, if not all, technologies shown in these videos already exists, or are in development. Nothing you see is impossible.

How to learn from Stackoverflow

For a while now, I have been using Stackoverflow as a reader, not a user. But, since recently I started helping others out too. And you would be surprised to see how much you can actually learn from Stackoverflow. I am going to demonstrate this to you how I am learning while I am helping others.

  1. First of all, register an account on Stackoverflow if you have not already. You can also login with facebook / openID or Google: http://stackoverflow.com/users/login
  2. After that, you go back to the homepage and set some favorite tags, and some Ignored Tags. This will help Stackoverflow to highlight the questions which are relevant for you.
  3. Once you have done this, the fun starts. There are a couple of ways to find questions relevant to you, I usually prefer the homepage. This is also quite a challenge as many people are watching the questions. You will have to answer within a minute or 2 (usually) to be the first to answer. But be sure you also answer the question correctly, and well formed so the one who asks the question can actually use your answer.

Well how about the learning? Quite easy. Just try to answer questions on which you are sure you should know the answer. This way, you will have to look for the answer yourself. Usually a short search on Google gives you the correct answer (and demonstrates how bad most people are in searching on Google).

If you are unable to locate the answer, someone else probably will. Just keep a watch on the question, or mark it as favorite (so you can look it up later on your profile page). This way, either way, you will learn from a question which you probably didn’t even ask yourself.

But now you know, and a next time you see a similar question, you know how to answer it.

But next to questions about stuff you actually do (in my case PHP/MySQL/JavaScript) you might encounter websites, technologies, etc, which might even give you new insights, or new ideas.

Titanium Appcelerator – Cross Platform App development

For some time now I have been working with the Titanium Platform. This Platform makes it possible to develop apps for Android and iOS all at once. And it actually works pretty good! Now ofcourse, there is a catch. There usually always is. Working cross platform gives you certain limitations. For example, iOS has different possibilities than Android has. Therefore you still would have to do the graphical part per platform, but luckily all the back-end stuff does not need to be developed twice.

The Titanium Platform is actually a JavaScript API. You develop the Apps once in JavaScript, and titanium compiles it for you to Java (for Android) and Objective-C (for iOS). It even is possible to create Apps for BlackBerry, but support for BlackBerry is very small, and is still only available in early beta. Therefore I highly recommend not to use this yet, and stick to Android and iOS for now.

A small example to create an App with just a blank window, which works on both iOS and Android:

1
2
3
4
5
6
7
8
9
10
11
12
var myApp = [];
var myApp.UI = [];
myApp.UI.createAppWindow = function(){
var mainWindow = Ti.UI.createWindow({
backgroundColor: '#FFFFFF'
});
return mainWindow;
}
var window = myApp.UI.createAppWindow();
window.open();

Some problems I encountered while I started with this platform are not to be forgotten. The community is about 1.5 million (as Titanium claims) but I have my doubts about that. There is a Q&A on the website of Titanium, but the real interesting questions on it still are not answered, sometimes even after over 6 months. But over time I found some interesting websites on which you can actually get some information, which might be useful for any of you. Found any more documentation, or nice tutorials? Let me know!