Broken PhoneGap 3.0.0 Installation and Documentation

// TLDR – start

  • Phonegap 3.0.0 documentation is broken.
  • Download the project template
  • replace your www folder with that in the project template
  • Use “phonegap local build ios”
  • Xcode project files in platforms/ios/HelloWorld.xcodeproj

// TLDR – end

So I go to install Phonegap for while playing around with developing on iOS and find that they have yet again changed their process of installation and setting up projects. While that annoys me somewhat, what really annoys me is that the installation and documentation is broken.

Firstly the following command from the documentation (http://docs.phonegap.com/en/3.0.0/guide_cli_index.md.html#The%20Command-line%20Interface)

$ phonegap create hello com.example.hello HelloWorld

Gives me an error

[error] downloaded www assets in /Users/thewheat/.cordova/lib/www/phonegap/3.0.0/www does not contain index.html, or www subdir with index.html

and it just created a few empty folders

$ ls hello/*
hello/merges:

hello/platforms:

hello/plugins:

hello/www:

Thinking it was just some weird error, I just continued on to the iOS documentation (http://docs.phonegap.com/en/edge/guide_platforms_ios_index.md.html#iOS%20Platform%20Guide_open_a_project_in_the_sdk)

$ cordova create hello com.example.hello "HelloWorld"
$ cd hello
$ cordova platform add ios
$ cordova prepare              # or "cordova build"

This still references “cordova” which was the name of the utility in the previous version before they renamed it to “phonegap”. I changed into the directory and ran the next command which gave the following error

$ cordova platform add ios
-bash: cordova: command not found

Changing it to “phonegap” doesn’t work either

$ phonegap platform add ios
[error] 'platform add ios' is not a phonegap command. See 'phonegap help'

But at least it gave some instruction on what to do. Following that I figured I has to run

$ phonegap local build ios

But alas, more errors

[phonegap] adding the iOS platform...
fs.js:413
 return binding.open(pathModule._makeLong(path), stringToFlags(flags), mode);
 ^
Error: ENOENT, no such file or directory '/Users/thewheat/Dropbox/projects/ios/hello/www/config.xml'
 at Object.fs.openSync (fs.js:413:18)
 at Object.fs.readFileSync (fs.js:270:15)
 at Object.config_parser (/usr/local/lib/node_modules/phonegap/node_modules/cordova/src/config_parser.js:24:45)
 at Object.platform (/usr/local/lib/node_modules/phonegap/node_modules/cordova/src/platform.js:64:15)
 at LocalBuildCommand.module.exports.addPlatform (/usr/local/lib/node_modules/phonegap/lib/phonegap/local.build.js:153:13)
 at LocalBuildCommand.execute (/usr/local/lib/node_modules/phonegap/lib/phonegap/local.build.js:95:32)
 at LocalBuildCommand.run (/usr/local/lib/node_modules/phonegap/lib/phonegap/local.build.js:70:10)
 at Object.build (/usr/local/lib/node_modules/phonegap/lib/phonegap/util/command.js:28:25)
 at CLI.module.exports (/usr/local/lib/node_modules/phonegap/lib/cli/local.build.js:34:20)
 at CLI.module.exports [as argv] (/usr/local/lib/node_modules/phonegap/lib/cli/argv.js:66:17)

I figured, that I had to manually download the template project structure  (https://codeload.github.com/phonegap/phonegap-app-hello-world/tar.gz/3.0.0), extract it, and replace my project’s “www” folder with that in the template.

$ rm -rf www
$ cp -r ~/Downloads/phonegap-app-hello-world-3.0.0/www .

And now finally it compiles!

$ phonegap local build ios
[phonegap] adding the iOS platform...
[phonegap] compiling iOS...
[phonegap] successfully compiled iOS app

And to open it up in Xcode and finally run the app

$ open platforms/ios/HelloWorld.xcodeproj

Perhaps the node install was corrupted due to something on my computer? But broken documentation such as this really annoys me: a person trying to learn a new tool / library wants to test and play around with it, not debug broken installation guidelines.

(On a sidenote: at least there are some guidelines, there are projects that I’ve seen that don’t give a ‘quick start’ example and assumes you know how to use the tool, which is another peeve of mine)

Advertisement

iPad screenshot crashes iPad 2 (iOS 5.1)

Somehow I managed to crash my iPad 2 by trying to edit an image in the Photos app. This is a repeatable problem and I’ve tried restarting, closing all apps and it still happens. Check out the video below to see the problem in action

The offending image is below: try saving it on your iPad and try editing it in the Photos app to see if this happens on your iPad.  In current testing, it doesn’t seem to affect the new iPad (3rd gen), iPhone 4 or iPod Touch (4th gen).  I can still edit other photos or screenshots so this totally puzzles me and is completely reproducible. It this another one of those special Apple bugs just for me?

Creating a Brunei Apple App Store Account Without a Credit Card

As mentioned in our episode of Corner Geeks 8: The Brunei Apple App Store, the video below documents how to create a Brunei account without a credit card.

Do note:

  1. not all apps seem available (e.g. WhatsApp) but most seem there.
  2. no music / movies / TV shows available
  3. AV mentioned that they currently selling Brunei iTune gift cards

The gist of the process:

  1. Load the App Store in iTunes
  2. Search for a free app (e.g. Angry Birds)
  3. Download the free app
  4. Sign up from the dialog box
  5. Select "None" as a "Payment Method" section during the registration

I still think getting a US iTunes Account is still the best option as it is completely unrestricted. You can create a US account without a credit card, using the same method above but select US instead of Brunei. You will need to buy gift cards online though, and I have bought iTune gift cards from both PC Game Supply and Jerry Cards with good results so thus far. See which works best for you and join the ecosystem that has yet to be rivaled (especially outside the US).

Corner Geeks 8: The Brunei Apple App Store

Corner Geeks Logo beta 2
MP3 link (right click > Save Link As…)

A ‘live’ / non-Skype Corner Geeks recording this week as I sat down with @mfirdaus as we discussed the Brunei Apple App Store while also passing him the InstallESD.dmg file for Lion. We hope that this is the start of more services being opened to Brunei and perhaps a legal way for people to get music, movies and TV shows in the future.

Show Notes

  • Apple brings the iOS and Mac App Store to 33 new territories, including Brunei!

  • We can register with a Brunei Credit Card
  • AV Electronics, the premium reseller of Apple products, says they aren’t currently selling Brunei iTunes gift cards

  • Registration without a credit card is possible with the same hack/work around to register a US account without a credit card (try download a free app in the App Store and create an account from there)
  • Brunei just has an App Store, not a full iTunes store with Music / Movies / TV Shows
  • Not all apps available in the iOS App Store: e.g. WhatsApp (could be developer’s setting when publishing app or some other unknown restrictions)
  • Prices shown in store are in US dollars
  • App ratings are reset meaning Brunei apps could make it to the recommended list
  • Sources for US gift cards: PC Game Supply / Jerry Cards (I have bought once from each of these sellers before and can verify that they work)

Streaming UBDFM on iOS Devices

You can stream UBDFM natively, without installing any application, on any iOS device (iPhone / iPod touch / iPad) by

This is shown pictorially bellow and may not be a perfect solution, I heard that it does not play in the background but I’ve tested it on my sister’s iPad with iOS 4.2 and it seems to work flawlessly. Feedback is appreciated =)

Pictorial Walkthrough

  1. Open Safari and go tohttp://bit.ly/ubdfmbrunei or http://202.160.1.55:8000/listen.pls

  2. Add this page to the Home Screen

  3. Give the link a name

  4. Enjoy easy access to stream UBDFM on the homescreen