Archive for the ‘software’ Category

iPhone Upgrade to OS 3.0

Wednesday, July 8th, 2009

Note: The issues here only affect iPhone developers and only those developers that upgraded from 2.2.1 to 3.0 after they’d provisioned their iPhone.

After WWDC, I setup my iPhone for development use as described earlier. I was running iPhone OS 2.2.1 at the time. Later, I upgraded through iTunes to iPhone OS 3.0 when it came out. I continued the process of teaching my self how to program the iPhone. When it came time to upload a new app, I couldn’t.

After much hunting around, some reading of documents, checking of hex identifier codes, and the requisite gnashing of teeth, etc. I figured out by using the XCode Organizer window that my iPhone wasn’t provisioned anymore. Well as the last real change was the upgrade to 3.0 that was probably it.

I used XCode’s Organizer to “Restore iPhone” (via a popup on the Summary tab) using the iPhone OS 3.0. This wiped the phone’s data and apps and restored it’s provisioning. It didn’t affect the OS version installed. The popup only allowed the 3.0 version to be restored.

This left the phone in a minimal mode only able to make an emergency phone call and with a graphic on the screen that it wanted to be plugged into my USB. So I did that. I used iTunes to re-restore the system to my last backup. Which, fortuitously was five minutes before I started this mess.

In the end, after the few non-productive hours I spend figuring this out, restoring, and re-restoring, I’m back to having my iPhone with all my data, and I can download new apps to it from XCode as well.

The Root Cause

I surmise from past experience in working with keys, certificates, and public key encryption that there is a tie between the certificate and the OS version. This is a pain for developers and breaks Apple’s user experience principle of allowing upgrades without pain. Granted, only developers are affected and perhaps it’s my failing as a new iPhone developer but I had found no warning of this effect of the OS upgrade.

I understand why Apple is using key signing for applications and that’s good. But as a coworker (hi Randy) once said: The point of security is to create a failure point. I would hope Apple tries to smooth this process in the future. An undocumented failure point is more typical of a Microsoft feature than the usual Apple experience.

Getting Started with iPhone Programming: Ten Steps

Friday, July 3rd, 2009

I thought I’d put a few notes together on my experiences so far too. These are the ten steps to get started with iPhone programming. There are several sources of useful information that you can Google for. And developer.apple.com/iphone is the canonical source for information.

If you don’t want to do all this, well, you can just hire me or someone like me to write your iPhone app for you. That works too!  Email me at contact@tangozulu.biz.

First things first, you don’t actually need an iPhone to get started, although you’ll want one soon enough. You can program with the iPhone simulator in the development environment, but somethings (accelerometers for example) are not simulated. But you to need a Mac, Windows won’t do. (That’s ok, you need a UNIX box anyhow and that’s what MacOSX is after all. The iPhone is UNIX too. Get over the Windows thing; Microsoft doesn’t let you develop MacOS software on Windows Vista do they?)

1. Get a Mac.

So, get a Mac, any of the laptop pros are good for this. I like the 17 inch, but each to their own. If you have some bucks, get a 3 GHz, 8 GByte memory laptop. Amazing capacity, but you don’t need that level machine to write code for the iPhone.

You’ll need XCode, this is the development environment for the Mac and for iPhone. No worries, this is free. This is listed on the apple site as the iPhone SDK. But, it’s XCode with the iPhone SDK bundled. This is free. But, you’ll have to become an iPhone Dev Center member to download this. You can do a free option, but you won’t be able to download your app onto an actual iPhone with that, you’ll only be able to use the sim. If you buy the membership for $100, then you can later get the cryptographic keys to sign your app and download to an iPhone device.

2. Get an ADC (Apple Developer Center) membership. Spend the $100 for this either now or later.

3. Download and install the iPhone SDK (containing XCode as well) on your Mac and install it. If you have a new Mac, use the Snow Leopard version. Else (assuming you’re not upgraded yet) use the Leopard version. If you’re not running Leopard yet, then upgrade already. You’ll have to.

Ok, you’ve got a working dev environment now. So, “hello world” is next of course. Use this link from Apple to make your first app and try out the dev environment. Run it on the sim, getting it on the iPhone is another issue.
And, if you’ve not done this yet, get an iPhone and use it. Try out some apps and get a feel for what works and what doesn’t. Buy some more apps and try those non-apple apps out too. The point of this is to get a feel for the UI and user experience. Without this you’ll make bad decisions in your designs.

4. Write and run “Hello World” on the sim.

5. Get and use an iPhone if you haven’t yet.

Now, you’ve gotta get your keys. All iPhone apps are signed, and the ones on the iTunes store are countersigned by Apple. You have to 1) get your key to sign your app, and 2) set up your iPhone to accept that for developer purposes.

To get your keys, follow the precise instructions in the iPhone Developer Portal with the Provisioning Assistant there. If you have the free account, you won’t see this. You’ll only see this link when you have your paid account. So shell out the $100 and upgrade already.

You first make a certificate request to the Apple certificate authority, this is the standard public-private asymetric key. The certificate is signed by Apple to make it good. You also have to make a device profile for your iPhone. If you’re a solitary developer the “team” aspect of this is a no-op. If you’re part of a development team, then there’s a hierarchy of controls that can be put into place.

The the second part, you provision your device with your profile and certificate. Beware, XCode 2.x and 3.x are a bit different here. Their directions were 2.x based, and we’re running 3.x. Look under “Code Signing” in the target properties for your application to find the settings they’ll talk about.

Also, note that all this in your profile and provisioning is case sensitive! This created problems for me, either I missed where Apple said it was case sensitive or they didn’t say.

6. Pay your $100 to upgrade your account

7. Request a key

8. Make a profile for your device

9. Provision your device

At this point, you can now put your hello world app on your iPhone and walk around and show it to your family and significant other(s).

Then, learn. Time to exercise your brain and read. The iPhone OS and software development works with ObjectiveC. (Yup, get used to it. I actually like it better than C++.) You’ve also got some massive amount of APIs in the SDK to get familiar with too. Then there’s the human interface stuff and design philosophy. It’s important as this is how Apple does their polished apps. This is a learning curve, but it will help as there’s tremendous amounts of stuff already written for you. You can stride along in seven-league boots making new apps and use all the stuff Apple made for you.

There are plenty of reference materials in the usual well-written Apple style about all this, and about the UI too. But one way to get started is to use the Stanford iPhone class on iTunes U to learn the basics, then expand from that. It was taught by Apple engineers, so that helps.

10. Learn, with online resources or perhaps with the Stanford class.

Or, if you don’t want to do all this, hire me and I’ll write your app for you. So, happy hacking!

WWDC

Friday, June 26th, 2009

As I mentioned in my last post, I attended Apple’s World-Wide Developer’s Conference in San Francisco recently. It’s been about five years since I’ve gone to a WWDC and I had a few observations.

First, Apple’s gotten cheaper with the food. Now, it’s probably still better than many conferences might have, but it used to be spectacular: catered hot food of various types, friendly to vegan and vegetarian friends, and stuff you’d pay well for in a good restaurant. I can’t fault them for cutting back, but I do wish there had been fruit in the morning. To their credit though, the box lunches were better than the breakfast, and there was free Odwalla juices all day on each floor.

But I solved the breakfast problem by simply buying my own of course. We were in the middle of San Francisco, so it was easy to find a grocery on the way to the hotel.

Second, I’m now past the median in age for the attendees. This one’s harder to solve. There were people there who could have been my kids. There’s not much I can do about this but stay active and lively. Don’t worry, I think I can still show those young whippersnappers a few things!

The trick, as always, is to keep learning. Sometimes it’s good to toss oneself into a new area and be forced to start over. The iPhone has some of that for me I think, while it is not completely new there’s enough new in it to keep me busy. Being forced to start over occasionally forces me to reconsider paradigms and points-of-view as we all did when we were younger. In turn, this keeps my outlook fresher.

Learning to fly did the same thing. I crossed a big hurdle when I realized that I couldn’t learn to fly like I learned other things. That is, I can’t stop the plane to go look up something like I do in software or hardware engineering. I had to learn differently and have it really in my head.

Third, while I was in the upper age half of WWDC, I was in the lower weight half. And I’m no athlete either! Fellow geeks, let’s face it: we don’t get nearly enough exercise! And we eat way to much bad stuff. Think of it as an I/O problem; garbage in, belly out. The human body is a machine meant to be used and we’re just using our brains and fingers. That brain works a lot better when everything else gets exercise too.  When a fifty-year old can leave guys 10 and 20 years younger huffing and puffing, something needs to be done!

Fourth: It was surprising how many of the attendees were either small business owners or running their own consulting operations. This may be one of those areas that the big businesses are in the minority. That hasn’t changed at all from past WWDCs and is heartening for the future of the economy in technology growth.

Ten Lines of Working Code per Day per Programmer

Saturday, May 16th, 2009

The title is an old rule of thumb for the volume of work a team is capable of. Of course, each programmer would write more that than per day, but after debugging and corrections this would be the net result.

There are other studies that say that the difference in productivity between an average programmer and an expert programmer can be very large: tenfold or greater. And expert is one with ten years or more experience AND who has kept up in the field.

I’m hoping that’s true. I have two weeks to write around 1500-2000 lines of working code. Ignoring weekends, the rule of thumb means I can get 140 lines working in that time.

But I’ve been writing software since 1984 more or less. (I actually learned programming four or more years earlier, that was first in assembler then Basic.) So I hope I’m an expert now, I will need to be one for the next two weeks at least.