Instructions
From the command line, create an empty project with iphone and android natures/targets. You should be able to build for ios
ti build -p ios
and for android
ti build -p android
without a problem
Now open up the tiapp.xml and change
<target device="iphone">true</target>
to
<target device="iphone">false</target>
and build again for ios
ti build -p ios
An error occurs.
[ERROR] Failed to run command "build"
[ERROR] TypeError: Cannot read property 'cyan' of undefined
at iOSBuilder.loginfo (/Users/stephenfeather/Library/Application Support/Titanium/mobilesdk/osx/3.4.0.GA/iphone/cli/commands/_build.js:1603:73)
at /Users/stephenfeather/Library/Application Support/Titanium/mobilesdk/osx/3.4.0.GA/node_modules/node-appc/node_modules/async/lib/async.js:610:21
at /Users/stephenfeather/Library/Application Support/Titanium/mobilesdk/osx/3.4.0.GA/node_modules/node-appc/node_modules/async/lib/async.js:249:17
at iterate (/Users/stephenfeather/Library/Application Support/Titanium/mobilesdk/osx/3.4.0.GA/node_modules/node-appc/node_modules/async/lib/async.js:149:13)
at /Users/stephenfeather/Library/Application Support/Titanium/mobilesdk/osx/3.4.0.GA/node_modules/node-appc/node_modules/async/lib/async.js:160:25
at /Users/stephenfeather/Library/Application Support/Titanium/mobilesdk/osx/3.4.0.GA/node_modules/node-appc/node_modules/async/lib/async.js:251:21
at /Users/stephenfeather/Library/Application Support/Titanium/mobilesdk/osx/3.4.0.GA/node_modules/node-appc/node_modules/async/lib/async.js:615:34
at iOSBuilder.initialize (/Users/stephenfeather/Library/Application Support/Titanium/mobilesdk/osx/3.4.0.GA/iphone/cli/commands/_build.js:1580:2)
at /Users/stephenfeather/Library/Application Support/Titanium/mobilesdk/osx/3.4.0.GA/node_modules/node-appc/node_modules/async/lib/async.js:610:21
at /Users/stephenfeather/Library/Application Support/Titanium/mobilesdk/osx/3.4.0.GA/node_modules/node-appc/node_modules/async/lib/async.js:249:17
If you change the android target to false, tooling will still blindly build you a nice new android apk.
Impact
Projects setup for iOS only can be tested against ios/android without modification. Projects built for android only (lets say on a windows system and then moved to the mac) need to be modified. The modification is fine, and understandable, but the error message above is not.
Solution
Tooling should check the tiapp.xml to see if an appropriate deployment target exists that matches the target from the command line switches/parameters and inform the user if the original project is missing any components.
Great news! Sometime in the past 5 years, this was magically fixed.