Hi,
I'm writing a code which can be used both for Android and iPhone.
I am coding the unzip function for both platforms, using modules (built using titanium.py as explained in docs).
My modules work without problem, I tested them.
I am on Mac OS X, and the modules are in
/Library/Application\ Support/Titanium/modules/iphone /Library/Application\ Support/Titanium/modules/androidAs they should. They are also declared in the tiapp.xml in project.
But I have a problem when I build the project...
In my code I include the modules using :
var zipmodule = null; if(Ti.Platform.name == "iPhone OS") { zipmodule = require( "iPhoneZip" ); } else { zipmodule = require( "androidZip" ); }and then I would like to test my application, using the following command (which I always use):
/Library/Application\ Support/Titanium/mobilesdk/osx/1.7.0/iphone/builder.py run /Users/me/Documents/MobileAppI get the error :
Third-party module: androidZip/0.1 missing library at /Library/Application Support/Titanium/modules/android/androidZip/0.1/libandroidzip.aWhich should not happen, because I try to build the iPhone App, but the build.py tries to find the android module...
Is this a bug ?? (because it should not do this, since the building platform is not android, as I tested it before "including" the module.
Did anyone encounter this issue ??
Any ideas for solving it ??
Thanks !
2 Answers
Accepted Answer
Try to add in tiapp.xml the modules specified by it's platform
<modules> <module version="0.1" platform="iphone">com.iphonemodule</module> <module version="0.1" platform="android">com.androidmodule</module> </modules>
The problem is with the line:
if(Ti.Platform.name == "iPhone OS")
In my experience, you get back "iphone" or "ipad" and not "iPhone OS".
My suggestion is to reverse the test and use:
if(Ti.Platform.name == "android")
with the else clause handling the iphone/ipad. Or else a switch statement making it easier to add additional platforms like blackberry too down the road.
Your Answer
Think you can help? Login to answer this question!