Posts Tagged ‘tips’

12 Jun 2014
0

TIP: Create global batch files for use in Terminal

I’m slowly but surely becoming a huge fan of running my development workflows through Terminal on my Mac, especially in the case of mobile development using Appcelerator Titanium. This is a quick tip to show you how to group terminal commands into batch files and have these batch files accessible anywhere when working in Terminal.

NOTE

  • I haven’t moved to Mavericks as yet, so my example below applies to Mountain Lion, but should also apply to Mavericks
  • In my example below, my batch file navigates to the required folder, builds and runs my mobile app the iPad Simulator
  • To enable/disable hidden folders and files in Finder, I recommend using Funter or Mountain Tweaks
  • You can’t double click on a hidden file to open it, you need to right-click on the file and select “Open”

Do The Following

  • Open TextEdit and add your commands to it, each command on a new line (See below what I did)

batchfile

  • Save this file and provide a file name without a suffix/file extension (i.e. file name = debugapp) and put it in a folder of your choosing. (e.g. “Users/{username}/Documents/terminalcommands“)
  • Under the “Users/{username}” folder, search for a hidden file called “.bash_profile” and open it
  • NOTE: if you can view hidden files in Finder and you don’t see the “.bash_profile” file, you will need to create it using TextEdit or something similar
  • Next, to add your folder path to the PATH Environment Variable, on a new line, type in export PATH=/Users/{username}/Documents/terminalcommands:$PATH

batchfile2

  • Save and Close
  • Restart Terminal

Test if this worked

  • You can check the $PATH variable by entering echo $PATH in Terminal
  • To run your batch file, simply enter the batch file name (e.g. debugapp) in Terminal
I hope this works for you :)
John
10 Jun 2014
0

XCode Tip: Possible fix if Application Loader hangs

I wanted to publish one of my mobile apps to the Apple App Store via Titanium Studio. The Archive was successfully created by Titanium and launched in XCode, but when I tried to distribute my mobile app to the App Store using the Application Loader, I got stuck on the following screen:

ApplicationLoaderHanging2

After waiting about 30 minutes, I cancelled the upload and started Googling for solutions. Thanks to this article, I managed to fix the issue by doing the following:

  • In Finder, navigate to “Applications”
  • Right click on XCode.app and select “Show Package Contents”
  • In the Finder Window that opens, navigate to “Contents/Applications”
  • Right click on “Application Loader.app” and select “Show Package Contents”
  • In the Finder Window that opens, navigate to “Contents/MaxOS/itms/java/lib”
  • Using a Text Editor (TextEdit / Sublime Text / etc), open net.properties
  • Check that http.proxyPort is set to 80 and that it’s unhashed (You can try the same with the https.proxyPort setting if this doesn’t work)
  • Save and Close
  • Restart XCode

ApplicationLoaderHangingAfter restarting XCode all was well with the world again :)

Hope this helps
John
22 May 2014
0

Appcelerator Titanium Fix for – dyld: Library not loaded

It seems that after upgrading XCode to version 5.1.1 on my Mac, my iPad Simulator through Appcelerator Titanium no longer works and receives the following error:

Screen Shot 2014-05-20 at 12.27.27 PM

My Specs are the following:

Apple Mountain Lion: 10.8.5
Titanium Studio: 3.2.3
XCode: 5.1.1
Mobile Application: 3.1.2GA SDK (iPad Only)

After some online searching and troubleshooting, I found the following JIRA Ticket that suggests using the “ios-sim” file from the “3.2.2 SDK” in your “3.1.2 SDK”. I tested it and it works.

To apply this fix on your side, do the following:
  • Quit Titanium Studio
  • In Finder, navigate to “Users/{Username}/Library/Application Support/Titanium/mobilesdk/osx/3.2.2.GA/iphone”
  • Copy the “ios-sim” executable
  • In Finder, navigate to “Users/{Username}/Library/Application Support/Titanium/mobilesdk/osx/3.1.2.GA/iphone”
  • Rename the current “ios-sim” executable in this folder (Just in case)
  • Paste the “ios-sim” file you copied
  • Start up Titanium Studio and Test again

I hope this Helps

19 May 2014
0

Quick Tip: Lessen your JavaScript code with 1 liner IF Statements

Not many people know this, but for simple JavaScript “If” Statements, there’s a Syntax that allows you to write out the entire condition on one line.

Let’s take a quick If Statement and type it out the most common way:

1
2
3
4
5
6
7
8
var whatAreMondays = "";
var areMondaysBlue = false;
 
if(areMondaysBlue){
   whatAreMondays = 'Blue';
}else{
   whatAreMondays = 'Awesome';
}

Behold…the 1 liner Syntax:

variable = (condition) ? 'value if TRUE' : 'value if FALSE';

By using a question mark and a colon, we can convert the above If Statement to the following:

1
2
3
4
var whatAreMondays = "";
var areMondaysBlue = false;
 
whatAreMondays = (areMondaysBlue) ? 'Blue' : 'Awesome';

Simple, but effective :)

21 Feb 2014
0

Solution to error when downloading Kitchen Sink from Git in Titanium Studio

So after updating my Titanium Studio to release 3.2.0, I wanted to re-download the Appcelerator Kitchen Sink app from Git.

Problem Identified

When attempting to download the Kitchen Sink App, I got an error message along the lines of:

No GIT Executable found in Preferences\Team\Git

This was very strange to me because I never did have Git installed on my MacBook, so why moan about it now?

Solution

What I did to solve the problem was the following:

  • Got to http://git-scm.com
  • Download Latest version of Git – (1.9.0) – (1.6 required according to Titanium, but I downloaded 1.9)
  • Install Git
  • Restart Titanium Studio

And BOOM!!! You can now download the Kitchen Sink and other sample apps.

Enjoy :)
John