Did I already mention this? Best thing since sliced bread: A template for creating a static framework for iOS in Xcode. Awesome.
Category: iPhone
Boost on iPhone with nil clash fix
I have set up a github repo that contains boost 1.48.0 with the nil fix from boost ticket #5010 here: https://github.com/root42/boostoniphone-with-objc-nil-fix
This repo is based on the ones by Pete Goodliffe and mz2.
Controlling MPD with the iPhone
Alignment of double values on ARM architectures
Consider the following code:
class C {
...
uint8_t *data;
size_t size;
...
void writeDouble(double v)
{
...
reinterpret_cast<double*>(this->data)[this->size] = v;
this->size += sizeof(double);
...
}
};
Looks harmless enough, doesn’t it? But here is the problem: It’s not necessarily portable or well behaving code. After debugging for about three hours, I found out something interesting. Namely that on ARM platforms, such as the iPhone, double values on the stack need to be stored at 8 byte aligned memory addresses. This was some existing code I was using, so it took me a while to get to this function and to its problem. Single precision float values have no such restriction, by the way. There are two workarounds in the above case. 1) Write a small for-loop that casts the double value to a uint8_t * and copy the double value byte-wise, or 2) use malloc to copy the value. I did the for-loop, since I thought that maybe the malloc call has too much overhead. I guess you could also cast the double to a uint32_t * pointing to two 32 bit words. Anyway, take care when doing such drastic casts. Some platforms might want alignment for some datatypes!
Mobile blog
Finally. My blogs now also support mobile devices with rendering suitable for small screens. All thanks to Blogger, who have introduced a beta version of the mobile templates via their beta program. You can force the template on every blog by appending “?m=1” to the blog URL. On your own blog, you can just enable it in your blog’s mobile settings via draft.blogger.com. Here’s how my blog looks in the mobile version:
ICE train power outlets confuse iPhone
Currently travelling with the german ICE train. The iPhone is plugged in, and I notice the following: the touch events are noisy and jittered. Unplug: all ok. Plug in again: flaky. I guess the 230V line here is of very low quality. I am using the Apple transformer, by the way.
How to make Hybrid Apps that run on 3.1 and higher devices (iPod, iPad and iPhone)
This fantastic blog entry helps you to actually use the UserInterfaceIdiom message, which is only available in iOS 3.2 and higher. This way, you can actually build a hybrid iPad / iPhone app that even runs on the original iPhone, which only comes with iOS 3.1 at best.
Mystery calls by my iPhone
In the last couple of days my iPhone made a couple of ghost calls. I.e. it called some people from my address book, without me doing the actual calls. I think I found the reason for that now. When you hit the home button for several seconds, an iPhone 3GS with iOS 3.x or 4.x will go into voice command mode. This even works when the phone is keylocked. The voice function is not so robust and will misinterpret quite a few background sounds, noises and voices for commands. I couldn’t yet make 100% sure that this is how it happened, but it seems to be the only possibility so far, since my phone is always keylocked, when I carry it in my pocket. So I figure the home button was accidentally pressed, and thus the voice command was activated. Will try to investigate this further…
Wishlist item for the iPhone: Clickable Maps Icons
What annoys me most in the maps application of the iPhone: You cannot tap or click on symbols. E.g. when you tap a bus-icon in the maps.google.com website, you will get a popup with the name of the bus stop and the lines that go there. This is not possible on the iPhone. I also use the fantastic Fahrplan application, however if you do not know the name of the bus stop you want to go to, you’re out of luck.
me.com woes
I have been using me.com for a while now, and am relatively happy with it. The automatic sync of the data between my work laptop and my iPhone is absolutely priceless. Now I’ve upgraded to the family account to share the (for my needs) ample 40 GB with two friends. Turns out, the other two accounts can only get 5 GB of storage. Ouch. That sort of sucks. Right now, 10 GB cannot be used at all, cause they are reserved for two more people. Why am I then paying for the extra storage anyhow?