Weinre: troubleshoot mobile and remote apps

1) Install it if you haven’t yet:

$npm install weinre -g

2) run it:

$ weinre -boundHost [your ip address here or localhost]

3) Put the following reference in the page you are trying to troubleshoot:

<script src=”http//[the ip address you entered]:8080/target/target-script.js#anonymous”></script>

4) Point your browser to the ip address you entered, that will give you the firebug kind of debugger:

http://[localhost or ip address]:8080/

 

 

Phonegap: avoid the build pain and suffering

Ok, part of the pain at least…

You still need to own (or access to) a Mac. And to pay the $99 fee to the Gods of Apple, and all the initial stuff to gather your Apple mobile developer certificate and your provisioning file.

But once you have those two, head to: https://build.phonegap.com/ and sign up for a free acct. Then, instead of building locally, upload your index.html file (which is the canvas of your app), and they take care of building the app for you in several different mobile apps, and give you the files or the QR reader code needed to download them to the phone you sign up for provisioning. No hassle. No pain.

You can only have one app at a time (unless you pain), but heck! it is free as in beer, and it works really good.

With the command line, things have become easier to implement:

http://docs.phonegap.com/en/edge/guide_cli_index.md.html#The%20Command-line%20Interface

Once you install:

$sudo npm install -g phonegap

You can create a new app:

$phonegap create [your app dir] [your app name]

And build:

$cd [your app dir]

$phonegap build ios

That will build the project locally, but the true timesaver is to use build.phonegap.com to do the work for you. In order to do that, you need
to login to your phonegap acct first.
$phonegap remote login -u iamreallyadog@gmail.com -p mYpASSw0RD

And now, to build remotely:
$phonegap remote build ios

If you get an error about invalid keys at this point, is because you need to provide one for your acct to work. Instructions here:
http://docs.build.phonegap.com/en_US/3.1.0/signing_signing-ios.md.html#iOS%20Signing

The process is a bit confusing and crazeee, but it basically involves creating a request for a signed certificate in your local env:
http://stackoverflow.com/questions/12126496/how-to-obtain-certificate-signing-request

and then, in the apple developer portal, a certificate (from the file created locally), and a provisioning file, and then download both to your local env, and using Keychain access / export you create a .p12 file, then you upload that and the provisioning file to your phonegap account (to create a sign key), and you are done. The key is going to ask for a password to unlock it before you can use it.

Once you finish building, you can use the scanner image to load it to your phone, or download the code to it from the Adobe website.

If you need to install plugins:

$ phonegap local plugin add https://git-wip-us.apache.org/repos/asf/cordova-plugin-vibration.git

For the complete list, see the Adobe build page.

Note: if you are using external js libraries or you need to hit external urls, you need to whitelist them in your config.xml file (follow this instructions):

http://docs.phonegap.com/en/2.3.0/guide_whitelist_index.md.html

Specifically, you need these two:

<access origin=”*.googleapis.com” />

<access origin=”*.gstatic.com” />