PhoneGap 1.4 was released some time ago (on 31st of January of 2012 to be exact) and so I was a bit surprised – to say the least – when I found out that my iPad project didn’t run after upgrading from 1.0, and it has been about 20 days already. Somebody messed up something.
Actually there were two (and one still is) issues: 1) Orientation change support for all iOS platforms were killed; 2) Orientation change support for < iOS 5 was killed (and still is!)
The first issue, with all iOS platforms, was rather quickly found and addressed. See bug #CB-212. This updated came out quickly as PhoneGap 1.4.1, but the 2nd bug remained.
So when PhoneGap 1.4 was released the developers of it did not notice one small thing due to improvements in iOS 5: orientation change event of iOS 5 is built-in unlike in the previous iOS versions, where this support was provided by PhoneGap.
Developers didn’t notice this and so they pushed out PhoneGap 1.4 breaking probably tons of applications. It didn’t take too long for this issue to pop-up: see bug #CB-221.
Even though the PhoneGap team has committed fix for both issues, they have not released 1.4.2 to address the 2nd issue, which boggles my mind. Actually, nowhere on the PhoneGap website is this 2nd issue addresses. You can find the description and fix from #CB-221, but nowhere on the PhoneGap website is there a mention of it. I think it should be mentioned somewhere.
The will require you to compile PhoneGap by yourself. I will show how to do that with Apple’s Xcode 4.
I have Xcode and PhoneGap installed in their default directories.
- Open ~/Documents/PhoneGapLib/Classes/PGViewController.m
- Add the code from #CB-221 right after the init-method
- Open up the PhoneGapLib.xcodeproj with Xcode and build. This will build binaries for different setups. See the build-folder.
- Move the generated PhoneGap binary from build-directory to the PhoneGap installation directory, which for me was: /Users/Shared/PhoneGap/Frameworks/PhoneGap.framework/
- Re-build your project
Now you should have orientation change events firing up again.