How do I install and use a module?

You must Login before you can answer or comment on any questions.

Ok, before you ask, I have been through the documentation and setup the module using the per project instructions and I can't get it to work. Here is what I did:

  1. Download the module (the Paypal module) from the Appcelerator marketplace
  2. Extract the contents of the zip to the root of my project folder to end up with projectroot/modules/iphone/ti.paypal/1.5/ and a similar folder for the android version of the module. I tried simply dragging the zip file onto the root of my project folder (as the documentation suggests), but unless I extract the zip file, the tiapp.xml editor does not pick it up.
  3. After extracting the module I did not have to modify my tiapp.xml manually. Titanium "detected" the paypal module and added it to my tiapp.xml file. Here is what is looks like now:
    <modules>
            <module platform="android" version="2.2.1">ti.paypal</module>
            <module platform="iphone" version="1.5">ti.paypal</module>
        </modules>
    4. In my app.js I now have: var paypal = require('ti.paypal'); but this produces an error in the iPhone simulator: [ERROR] Script Error = Couldn't find module: ti.paypal

I've been over the documentation and cannot find where I'm going wrong ... any help would be appreciated.

Many Thanks.

2 Answers

Accepted Answer

have you cleaned the project to force a complete rebuild?

— answered 8 months ago by Aaron Saunders
answer permalink
3 Comments
  • Wow. So simple. Thank-you.

    In future, I will try this first before doing anything else.

    I feel like such a noob. lol

    Thanks again.

    — commented 8 months ago by Manus Du Plessis

  • Totally not noob related.

    As heads up, you may run into something simliar in the future should you try to add code to your project that calls an API you have never used before. Clean forces the Titanium scripts to reparse your code looking for all API references.

    Clean is not always a solution, but is frequently.

    — commented 8 months ago by Stephen Feather

  • Thanks for the tip Stephen. I remember reading about the clean thing when I was dealing the UI scaling issues on Android and eventually resorted to:

    supports-screens android:anyDensity='false'

    in the tiapp.xml - which does a fantastic job of scaling btw. Seems like there's certain situations (like modifying the tiapp.xml) that require a clean and full rebuild. Will definitely remember this in future :)

    — commented 8 months ago by Manus Du Plessis

Have you tried doing a Project > Clean and then running again in the simulator?

— answered 8 months ago by Jason Priebe
answer permalink
3 Comments
  • Hey, thanks. Yes, this worked. Will always remember to do this in future.

    Thanks again :)

    — commented 8 months ago by Manus Du Plessis

  • Manus: please mark Aaron's answer as "best"; you should do this any time somebody provides you a working answer.

    — commented 8 months ago by Jason Priebe

  • Cool. Will do!

    — commented 8 months ago by Manus Du Plessis

Your Answer

Think you can help? Login to answer this question!