Friday, August 28, 2009


First off, my apologies for the dearth of news. I've been busy, distracted and out of sorts lately. But I'm back. And I didn't forget about you guys, despite the lack of updates.

A couple of weeks ago I made the decision to not release an update until I had the compass rotation working properly. It didn't feel right to release a 3.0 update without better compass support. My apologies for the delay, especially for those who are waiting for the coordinate saving bug fix. I know it's annoying and less than ideal.

I've been struggling with the compass rotation for an embarassing amount of time. I didn't have a 3GS until a few days ago, so I wasn't able to do a lot of actual testing. The little that I did get to do, the compass worked quite incorrectly. Sure the compass spun, but it didn't spin where I expected or where I wanted to go.

So I took today off of work and decided to make it my goal to get the compass working today. It's working. And the code has been updated in the SVN repository for those of you following along at home. Assuming anyone is.

For you aspiring developers out there, I want to let you in on a little CLLocation secret. When the description of a property says this:

"The value in this property represents the heading that points toward the magnetic North Pole, which is different than the geographic North Pole. The value in this property is always measured relative to the top of the device, regardless of the device’s physical or interface orientation. The value 0 represents magnetic North, 90 represents magnetic East, 180 represents magnetic South, and so on. The value in this property should always be valid."

This paragraph means that the heading 0 is NOT relative to the top of the screen, which I incorrectly understood, but that 0 is always relative to the direction that is NORTH. Or magnetic north in this example. Big difference. Hopefully you can see how I misunderstood this information with the example above. I'll have to send a note to apple about that.

So what does that mean to you guys? Well, long story short, I've spent a number of of evenings and a half a day today trying to figure out why my compass wasn't working. Well, unbeknownst to me, it WAS working... assuming that 0 was the top of the iPhone regardless of where it was pointing. Which is not the case. I simply had to do some correctional math and viola... working compass!

I feel kind of dumb now.

But here I am hoping that sharing my folly with the world does some good for someone. =)

So, that out of the way, I still have one problem to tackle relative to getting the release out. I thought I had the map view completely working but the titlebar is now showing up funny. Funny as in there are two that are overlapping improperly. I suspect this is due to the new SDK I am using with snow leopard, but it's difficult to say for sure.

On a side note, I've not seen a ton of snow leopard so far, but what I have seen I like! For $29 it's worth the upgrade price, if nothing else for the wake/sleep speedup times on my laptop. =)

Anyway. Once the above issue is taken care of I will add an auto-zoom the map view. When it's opened it will show both the target location as well as the current location. It shows only the current location right now, but I'd like it to zoom in/out far enough so that it shows the current location and the target location both on the same map screen appropriately. I think I know how to do this; it will just take a little math and playing around with the API to make sure I'm thinking about this correctly. I almost left this for another update but couldn't. Like the compass it just wouldn't feel right unless I get this working okay for the update.

Oh, and I've added a preference to choose to see magnetic north or true north, with the default set to true north.

Once I submit the update I'll post again and reiterate the feature list for the new version.

Suggestions, comments and criticism are always welcome. Thanks for dropping by!

No comments:

Blog Archive

About Me

My photo
DadGuy has been working with apple computers since the mac classic. I love games and puzzles and like to solve problems. I'm having a blast developing for the iPhone and iPad.