Monday, July 19, 2010

Continuing Hurdles

As I've posted previously, there are some things I really appreciate about Microsoft's approach to supporting its developers (at least back in the day when I was writing Windows code). Primary among them is that Microsoft gives you the source code to their framework, the Foundation Classes. You get to see everything that the framework does, all the way down to the Win32 calls. And even then you can see the disassembly if need be. Apple has taken the opposite approach - they hide everything. I was talking with my mom tonight and I likened it to a server in a restaurant. You tell her your order - "I'd like to put a button in this location with this text" - and then she runs off, makes your order, and delivers it to you, but you never get to see how the secret sauce is made or if the cook spit in your food. Well, right now I'm feeling like Apple's spitting in my food.
I had been working diligently on getting my Alpha 2 completed. iOS 4 had just been released and I figured I'd get A2 out and then upgrade to the new Xcode version that supported iOS4. Then I got my new phone - iPhone 4, yay! (except for the antenna problem - boo!) - but it had iOS4. *sigh* So while I could install my iOS 3.1.3 version of software on my iOS4 phone, I couldn't debug it. And wouldn't you know, I experienced a crash. So I figured - well, maybe I'll just upgrade, recompile for iOS 4 and things will magically work! Okay, I didn't really think that, but I figured I was really close and this upgrade was: a) ultimately necessary, and b) worth the investment. So I bit the bullet and upgraded. And compiled. And fixed some problems.
But then I tried to run it. And found that now it crashes, but in a very unusual way - the stack is getting blown somewhere. Not that I changed anything that would cause that - it's just the combination of the code I had written for 3.1.3 apparently had a bug or there was a feature of the compiler that made it play nice. And this is where the first paragraph comes into play. The crash is happening deep inside Apple's code and I can't figure out where it's crashing.
Because of the crash, I've been unable to actually locate the place where the stack goes "kaboom". I've run into this a couple of times in the past on Windows - unallocated memory in release mode that overwrote the call stack pointers - but this is in debug mode, which should be a lot nicer and friendlier. But because I can't quite figure out where in the framework code it's crashing (because I don't have the source code), I'm stuck now doing another task that I'd postponed until after Alpha 2 and redesigning part of the code to help identify the general area that's causing the problem.
So, while I'm actually pretty close on having everything complete, I'm spending more time refactoring something that I'd planned to do later and am being forced to do now. I guess I should be looking at the glass as half-full as I now don't have to do this in the future, but at the same time my general timeline for Alpha 2 has gone out the window.
So because of a bug that I couldn't track down on the new OS I had to do two additional tasks that I'd planned on doing later. This has actually been the general story of my experience with iPhone development. Of course, Apple does tend to schedule all of their upgrades around the June timeframe (because of WWDC), so maybe I should just stop starting apps in April. And then maybe I'll feel like Apple's not spitting in my food.