31 May 2011

Deployed

I uploaded my very first project to an actual, real device this afternoon. Geez, Apple sure doesn't make that process easy (the guided Assistant on the web site wasn't much help, either), but with the wisdom of a book, I was able to get everything working.

Of course, nobody else is as impressed with this feat as I am, since nobody else knows what kind of hassle you have go through — and it's not much of an App to begin with (all I did was modify the sample project I was buiding from another book). My son, pictured (his face bounces around the screen), was bored with it by the third time I showed it to him. Oh, well.

30 May 2011

Exception

So there I was, mucking about in Xcode, following along with an example in that book I've been studying (trying to determine why the keyboard wouldn't hide when I touched outside a text field). In the spirit of (reckless) experimentation, I tried adding an Outlet to the top level View of a View Controller, dragging into the Header file to automagically create it. I knew almost at once this wouldn't be what I wanted, and I deleted the reference in Interface Builder, and the code it had added to the other files.

But when I ran the program, it threw an exception. Being so new to all this, I didn't think to check the log files, and when I couldn't work out what the error was (or fix it), I gave up, restored an earlier version of the project from Time Machine, and tried again — same result. I restored an even earlier version and tried again — and got the same error!

When I finally had the good sense to have more than a passing glance at the log file, I noticed the reference to the name of the Outlet I had added, but removed! But these were older versions of the code, before I'd even made that change.

I made a thorough search of the code, and my NIB file, looking for any reference to the deleted Outlet. I couldn't find it anywhere.

I eventually replaced the NIB file with a version from the tutorial from the book I was following (it was identical, and easier than rebuilding it from the bottom up), and all was well, everything ran just fine. But now I'm left wondering -- what could I have done to make this error so persistent, across different versions of the file? I'm already kinda uncertain about the way Xcode 4 will automagically add code under certain circumstances — that's probably more dangerous than useful for the novice.

I find I'm learning the most when I'm making the most mistakes. Not so much this time, though. This was just bewildering.

27 May 2011

Five Days

It has been a good week. I have been able to devote all of it (well, almost all of it — today has not been adequately distraction-free) to study. I spent several pointless, but (mostly) useful hours yesterday building on one of the examples in the book I've been using, just to see if there was a way to do what I thought ought to be done. I accomplished almost everything I tried — I just couldn't get the scroll-back-to-bottom view to animate when the keyboard disappears. (For some reason this particular bit didn't have an "animate" function, and I finally had to give up trying to work around that. There are ways around the problem, and I tried several, but nothing did what I wanted.)

What I'm hoping for is to be able to understand just enough to be able to fix the (many) mistakes I make, and if not to ask the right questions, to be able to find the answers.

26 May 2011

Xcode 4

Xcode 4 was released during those few months I was idle — it's to my advantage, I suppose, that I haven't spent so much time using Xcode 3 that I've developed habits that will make it difficult to adjust to this new way of working. But I'm still new at this, still very much reliant on step-by-step instructions, and when those steps are different, it can be kinda frustrating.

And there's not really a manual — not one that I've been able to find, anyway. There's a "Transition Guide" (and I have that) but it's not much of a guide for the beginner. I found two books, but one is due out in about a month, and the other isn't expected 'till early next year. (It's like that with technology books, particularly in print. Difficult for them to stay current.)

I discovered one interesting feature only because I happened to read about it in a review: with Interface Builder now built-in (instead of a separate application), you can set up code and your NIB files in a split view, and drag from the NIB to the code to automagically create outlets and actions. Works great — but then you discover that when you add this stuff to your Header file, it's also adding it to your Implementation file when you weren't expecting that, which can be the cause of some confusion if you're just trying to follow directions.

23 May 2011

Restart

Yes, I've been away for awhile; sorry, no I don't have the time to explain why just at this moment; and yes, I'm throwing another $50 book at the problem. This time, it's Beginning iOS 4 Application Development, which seemed like as good a book as any to get re-started with. From a brief few hours' experience, it seems like there will be slightly less hand-holding, which might be best for me at this point.