Follow Slashdot stories on Twitter

 



Forgot your password?
typodupeerror
×
Image

Beginning iPhone Development 216

Cory Foy writes "When my wife got a Touch several months back, the first thing I wanted to do was build some applications for it. Who wouldn't want to play with a device that has accelerometers, position sensors and multi-touch gestures? But being new to the Mac world, I needed something to help guide me along. Beginning iPhone Development aims to be that guide. But does it live up to the challenge of teaching a newbie Mac and iPhone developer?" Read below for the rest of Cory's review.
Beginning iPhone Development: Exploring the iPhone SDK
author Dave Mark, Jeff LaMarche
pages 536
publisher Apress
rating Five $1000 Rubies
reviewer Cory Foy
ISBN 978-1-4302-1626-1
summary A great introduction to the iPhone SDK and getting into iPhone Development
The first thing you'll need to do is head over to the Apple Developers Site and register for an account. You can then download the iPhone API. Note that while the API download and simulator are free — deploying to a real iPhone or iTouch is not, even if it is your own. To do that you have to apply to the iPhone Developer Program which is $99. For the book, you'll be fine with just the simulator with the exception of any accelerometer application, since the simulator doesn't have that feature.

With that out of the way, I was quite impressed with the book. Although I've done quite a bit of development in the past, I haven't worked with Objective-C before, and was a little concerned if I would be in over my head. If you are in that position, don't fear — the authors do a great job of walking you through, and you'll find yourself working with it in no time.

The first chapters introduce you to the basics of the iPhone and development, starting with the canonical "Hello, World" application. The book walks you through how to get and install Xcode and the iPhone API. It then introduces you to Interface Builder, the partner-in-crime to Xcode. Even in the first chapter, the authors show their attention to detail, explaining common issues you might run into (like trying to Build and Run while your iPhone or iTouch is plugged in to your Mac).

Chapter 3 introduces the Model-View-Controller paradigm, a pattern that is probably one of the most misunderstood patterns in UI development. They give you enough information to be familiar with the terms you'll be using, and they very much mean it when they tell you not to worry if you aren't understanding something — they always loop back around to make sure you understand it.

Chapter 4 was a long chapter for me, but introduces some important concepts around user interaction and controls. By the end, you have an interface which has a variety of controls which interact with each other. As with the other chapters, the authors introduce tips and tricks to make things easier (for example, Option->Cmd->Up Arrow to switch from the header to implementation file in Xcode).

Chapter 5 covers autorotation and basic animations, including linking in the Core Graphics Framework. I especially like how the authors gave three different ways of making your app auto-rotation aware, describing the benefits and drawbacks of each. Chapter 6 follows this up by introducing multi-view interfaces, something very necessary as you get into more complex iPhone development.

Chapters 7-9 describe various methods to presenting information to users, including toolbars, table views, hierarchical navigation and hierarchical lists. However, it isn't all drag-n-drop, the authors get into some good (and sometimes deep) conversations about what you are doing. For example, in Chapter 8, they talk about issues with NSDictionary and how to create deep mutable copies.

Chapters 10-13 are the last of the "fundamentals" — application settings, basic data management, custom drawing using Quartz and Open GL, and taking inputs (including gestures and multi-touch). As someone who spends most of his time as far away from graphics libraries as possible, I was quite impressed with the basics that were introduced and what someone like me could get up and running.

Finally we get into the fun. Chapter 14 introduces Core Location, allowing to figure out where in the world you are. The book goes through a discussion about the various ways to get location information, and drawbacks of each. (Helpful tip: no matter which method, if you are polling every second, you'll drain the battery pretty quickly). For the simulator-only users, this is when things start to become tricky. Chapter 14 does work, though you aren't prompted for access to Core Location.

Chapter 15, however, is useless without an actual phone, even though it's perhaps the most fun. In this chapter, the book goes through the accelerometer and all the interesting things you can do with it. There's even a small discussion on the physics (but just enough!). Both apps you create (Shake and Break and the Marble game) are quite fun for someone just starting out with all of this. It's a shame Apple couldn't figure out a way yet to include the accelerometer in the simulator.

Chapter 16 covers using the iPhone camera and Photo Library. It's short, but it shows the power of the simple interfaces Apple provides. In just 9 pages you'll be capturing images right from the iPhone.

The final two chapters I thought were quite fitting — Localization and Follow-Ups. In the localization chapter, the book covers extracting strings out to resource files and using locale to read them in. Having a day job which ships our software in 12 different languages, I know first-hand how difficult localization can be to get right, so I was glad to see this chapter. The final chapter is just a wrap-up of resources you can reach out to for help and information.

All in all I was very surprised and pleased with the book. I've had the fortune of reading many technical books, and few do a great job of walking someone through the basics without making them feel like a dolt. It felt like every time I was stuck or unsure there was a tip, hint or paragraph which explained what was going on.

The main drawback to me is the fee to deploy apps to your own phone. This wasn't something I ran into doing either J2ME or Windows Mobile apps in the past, and it is a shame that to even work on your own phone you have to pay a fee. However, since the fee does give you the ability to submit apps to the App Store, then I guess it's a consolation. I'd rather Apple lock deployments to one iPhone (or iTouch) for the truly casual people who just want to do interesting things on their own phone.

In summary, I give this book five $1000 Rubys for making a clean, concise, easy-to-read and follow introduction to iPhone development. Great job guys!

You can purchase Beginning iPhone Development: Exploring the iPhone SDK from amazon.com. Slashdot welcomes readers' book reviews — to see your own review here, read the book review guidelines, then visit the submission page.

*

This discussion has been archived. No new comments can be posted.

Beginning iPhone Development

Comments Filter:
  • by Anonymous Coward

    What the hell is an iTouch? Sounds like something from a sex store.

  • by jDeepbeep ( 913892 ) on Monday January 19, 2009 @02:38PM (#26519089)
    If you have a background in both C/C++, and in OOP. Otherwise, I'd suggest getting a little background in those first. I think it's slightly misleading to imply that this book is the best hand-holder in this regards.
    • Re: (Score:2, Funny)

      by ciaohound ( 118419 )

      Best hand-holder? He gave his wife an iTouch. They're beyond hand-holding, know what I mean, know what I mean, nudge nudge, say no more?

    • I do not see the point in learning C++ first. It will take a long time, and you'll just have to unlearn it anyway. Why would you learn the more complicated language first?

      I've coded a fair amount in both languages: in fact I coded in both languages before breakfast this morning, and I cannot imagine thinking that it was easier to learn C++. I've been paid to write C++ for 12 years and template notation still confuses me.
    • Re: (Score:2, Informative)

      by cadience ( 770683 )
      To keep in vein of this thread, here's another book by this same publisher: Learn Objective-C on the Mac http://www.amazon.com/Learn-Objective-ndash-C-Mac/dp/1430218150/ref=pd_bbs_sr_2?ie=UTF8&s=books&qid=1232417589&sr=8-2 [amazon.com] It has received relatively good reviews on Amazon.
  • Code-Signing (Score:3, Informative)

    by Yokaze ( 70883 ) on Monday January 19, 2009 @02:52PM (#26519279)

    > Note that while the API download and simulator are free â" deploying to a real iPhone or iTouch is not, even if it is your own.

    Not necessarily true. There are ways to circument [246tnt.com] the code-signing.

    • Re: (Score:2, Funny)

      by dangitman ( 862676 )

      There are ways to circument [246tnt.com] the code-signing.

      Apparently, there are also ways to circumvent the letter "v".

  • API? (Score:3, Funny)

    by mr_da3m0n ( 887821 ) on Monday January 19, 2009 @03:02PM (#26519403) Homepage

    You can then download the iPhone API

    I was under the impression that this was called a SDK, and not an API?

    Then again, maybe I am just being Lord Pedantro the Quarrelsome.

  • First Step (Score:5, Informative)

    by slashkitty ( 21637 ) on Monday January 19, 2009 @03:05PM (#26519439) Homepage
    I thought the first step was getting a Mac, then you can get the sdk. It's actually a pretty high barrier to entry for a developer.
    • Re:First Step (Score:5, Insightful)

      by shmlco ( 594907 ) on Monday January 19, 2009 @03:35PM (#26519809) Homepage

      As opposed to developing for Windows Mobile, where one can create applications just by thinking them into existence? Oh wait, I have to buy a PC to do WM development! Bummer.

      • Re:First Step (Score:5, Insightful)

        by Belial6 ( 794905 ) on Monday January 19, 2009 @03:49PM (#26520013)
        Given that there is a greater than 90% chance that a person wanting to jump into Windows Mobile development will already have a machine capable of doing the development, and a less than 10% chance that a person wanting to jump into iPhone development will already have a Mac capable of doing the development means that the OP has a very valid point.
        • Given that there is a greater than 90% chance that a person wanting to jump into Windows Mobile development will already have a machine capable of doing the development, and a less than 10% chance that a person wanting to jump into iPhone development will already have a Mac capable of doing the development means that the OP has a very valid point.

          Sorry, you're not being logical here. I very much doubt that those specific groups of developers have computer ownership patterns that match the general population's. Also, buying a new computer is a very different sort of "barrier" to a developer than the general populace - the kind of barrier that might be called an "incentive" or an "excuse".

        • Theres probably a 90% chance that any machine capable of developing a vista app is probably more than capable of running OS X well enough to develop an iPhone app, assuming you don't mind futzing with OS X enough to get it to boot on your pc (which may be as simple as downloading an install image for most people now days).

        • by mgblst ( 80109 )

          You don't work with stats regularly, or you would realise how wrong you are.

          Or do you think that there is exactly the same chance of a developer for Windows getting into iPhone development, as it is for a Mac Developer? Or do you think it is more likely that a Mac Developer, who already knows objective-c, Xcode, Quartz, mac development, would get into iphone? Since it would take a few hours for a Mac Developer to produce an iphone app, I think that they would be much more likely.

        • Re: (Score:3, Insightful)

          by NilObject ( 522433 )

          10% chance?

          Since when were computers randomly distributed among people?

          • by wurp ( 51446 )

            Well, I just built an iPhone app (http://www.pharceapp.com) and I had to buy a MacBook Pro to do it.

            I agree there's a correlation between people using Macs and people writing code for iPhones, but it's nowhere near 100%.

        • by shmlco ( 594907 )

          "Given that there is a greater than 90% chance that a person wanting to jump into Windows Mobile development will already have a machine capable of doing the development..."

          Actually, you're correct that I already own a machine that can do Windows Mobile development. It's a 24" iMac that runs XP under Parallels.

          And given that much "development" these days is for the web, you might be surprised at the number of developers who own Macs vs. Windows boxes. The 90% number is the general population as a whole, and

        • Did I miss the part where MS Windows and/or MS Visual Studio became free? Because I own a machine that can run both, and a phone that runs Windows Mobile 6.x; if someone can tell me how to develop for that platform without spending $600+ I'd be eternally grateful.

          Even if you assume the developer already has free access to MS Windows, MS Visual Studio is not cheap by any standard for personal software development.
      • "Oh wait, I have to buy a PC to do WM development! Bummer."

        Is there something about Bootcamp that prevents you from doing WM development on a Mac?

        That being said, he never said or really implied that WM development would be different. He was just commenting on the topic.
      • Comment removed based on user account deletion
    • How do you make a small fortune as an iPhone developer?

      Start with a large one.
    • The SDK requires an Intel Mac.
  • Accelerometer (Score:5, Informative)

    by Bogtha ( 906264 ) on Monday January 19, 2009 @03:06PM (#26519459)

    Chapter 15, however, is useless without an actual phone, even though it's perhaps the most fun. In this chapter, the book goes through the accelerometer and all the interesting things you can do with it. There's even a small discussion on the physics (but just enough!). Both apps you create (Shake and Break and the Marble game) are quite fun for someone just starting out with all of this. It's a shame Apple couldn't figure out a way yet to include the accelerometer in the simulator.

    It's possible to link up an iPhone's accelerometer to the simulator, and it's also possible to link up the accelerometer in a MacBook to the simulator as well. More details here [blogspot.com]. Honestly, though, it's probably easier to just jailbreak your iPhone.

  • Interface Builder (Score:5, Interesting)

    by fragbait ( 209346 ) on Monday January 19, 2009 @03:08PM (#26519471) Homepage

    The biggest problem I've had so far is Interface Builder. It isn't the most intuitive piece of software. Dragging and dropping to connect button actions to methods between two pieces of software (XCode and Interface Builder) that don't actively sync with one another, at least not as I've yet to find.

    I already had the C/C++ and GUI/fat client app building experience from 10 years back.

    +fragbait

    • Re: (Score:2, Informative)

      by Anonymous Coward

      Last time I used XCode/Interface builder, a method added in XCode would show up in IB as soon as you saved the .h file that declared it.

    • Fairly bizarre (Score:5, Informative)

      by spaceyhackerlady ( 462530 ) on Monday January 19, 2009 @04:14PM (#26520335)

      Interface Builder is fairly bizarre, but it starts to make sense after a while. It does. Really.

      My primary reference for iPhone development has been Erica Sadun's [ericasadun.com] book, but I may pick this one up too.

      BTW: people may bitch about code signing, but Apple gave me my signature when I asked for it. This is minor compared with what was necessary when my employers wanted to do Brew [qualcomm.com] development. I considered going the jailbreak route, but ended up not doing so.

      ...laura

    • It's a bit bizarre at first, but you get used to it before long. The trick is to lay out the interface first, then code to it, and finally to connect everything up and hope it works.
    • Re:Interface Builder (Score:4, Informative)

      by am 2k ( 217885 ) on Monday January 19, 2009 @08:02PM (#26523307) Homepage

      Dragging and dropping to connect button actions to methods between two pieces of software (XCode and Interface Builder) that don't actively sync with one another

      Your experience is a bit outdated. Starting in Leopard, they do sync actively.

  • iTouch (Score:5, Insightful)

    by linuxci ( 3530 ) on Monday January 19, 2009 @03:13PM (#26519545)

    iTouch [itouch.co.uk] is the name of a UK company that provides mobile content. They were around a long time before the iPod touch but lost top spot in Google to Apple despite the fact they don't make a product of that name.

    • (Notice: I'm the reviewer)

      iDang it. iI'm iSorry. iI iGot iToo iCaught iUp iIn iIing iEverything.

      - iCory

  • iPhone SDK training (Score:3, Informative)

    by Presto Vivace ( 882157 ) <ammarshall@vivaldi.net> on Monday January 19, 2009 @03:19PM (#26519605) Homepage Journal
    There is a company in Reston VA that trains iPhone developers http://www.aboutobjects.com/iPhone-SDK-Course.do [aboutobjects.com]
  • Very coincidentally, I picked up this book last Friday. Downloaded the SDK, and did the first chapter (dead easy). Beyond that, the book does recommend at least a passing knowledge of Objective-C. Fortunately, I have a "Learning Objective-C" book for noobs (which I am when it comes to anything C).
  • Does anyone know what the state of Qt is on the iPhone? I figure the core classes are ok, but does it use the same Carbon/Cocoa APIs?

    I'd love to use Qt just so I don't need to learn a whole other development platform

    • Honestly? Qt on a phone? I hate having to have it on a desktop machine, let alone potentially on my person.

      That aside, Cocoa's UI API isn't hard to learn. It's dead easy. The code goes into the method files, you declare it in the header files, you point the buttons at the bit of code to execute using a point-and-click interface. And it's less of a pain than Qt.

  • First barrier (Score:2, Insightful)

    by Artifex33 ( 932236 )
    I have an iPhone 3g myself, and a few weeks of use got me excited enough about app development to feel truly let down when I discovered I'd have to buy a mac to develop on. Actually pricing one out that I could use for high-end photoshop work in addition to iPhone development was a sobering experience. Add that to the learning curve associated with migrating to OSX from WinXP, and I'm back to Flash development on my PC.
    • So why do you need to do your high-end Photoshop work on the same machine you use for programming? Sure, it might be a -little- quicker, but networking makes a whole world of difference.

      A Mac mini could be just fine for XCode work for most people, and what exactly is your definition of high-end Photoshop work? And a learning curve coming from XP to OSX? That's like a couple hours.

      Sure, there's a learning curve to XCode, but it's not as steep as people who have never touched it think. Join the ADC for free,

  • When my wife got an Touch several months back, the first thing I wanted to do was build some applications for it. Who wouldn't want to play with a device that has accelerometers, position sensors and multi-touch gestures?

    When I read about the accelerometers, position sensors and multi-touch gestures, of course I thought you were referring to your wife...
  • Reinvigorated (Score:4, Interesting)

    by TellarHK ( 159748 ) <tellarhk@hotmaiC ... minus physicist> on Monday January 19, 2009 @04:44PM (#26520795) Homepage Journal

    I have to say that this book, which I picked up last week, has really given me a kick in the pants as far as getting back into programming. I haven't hardly done a damn thing since college in '02, and since I went to a pretty craptastic school that doesn't mean much.

    MS Visual C++ really made programming a slog, compared to the IDE that Apple came up with for XCode. I'm just a couple chapters into the book now, but all in all I'm really enjoying the process of programming again for the first time since GW-BASIC. I can understand why a lot of people here (especially here) complain about having to buy a Mac, having to use XCode, having to do things Apple's way but for something like the iPhone and iPod Touch development I can't imagine a better route.

    This is for the most part a very good book, at least for my rusty brain, but it definitely needs some kind of Objective-C accompaniment if you're not familiar with the language and want to do more than just follow instructions. Well worth the money.

    And again, to those people complaining about XCode and doing things Apple's way, dig around the ADC site and you'll see that Apple's learned a hell of a lot since the days when CodeWarrior was the only hope for a Mac developer's sanity.

    • by mgblst ( 80109 )

      I find using XCode a much more pleasant experience that Visual Studio, and I have been programming PCs since MS-Dos 3.2. There are a few annoying things, like the error messages could be improved, and you need to restart it every few days.

      • I don't mind Visual Studio, and I am a Mac guy. XCode does things a bit differently esp. in regards to the Interface designer, and it's a bit harder to get into than Visual Studio...
    • Re: (Score:2, Interesting)

      by Zero Zero ( 106980 )

      This is for the most part a very good book, at least for my rusty brain, but it definitely needs some kind of Objective-C accompaniment if you're not familiar with the language and want to do more than just follow instructions.

      The co-author recommends Learn Objective-C on the Mac [blogspot.com] as just such an accompaniment.

  • Get the frame buffer, draw a few bitmaps in, and put in a few bodily noises. You'll be rich in no time.
    • Sadly, this works.

      I hate you iFart. As an iPhone dev, I hate you and your top 100 charting feats.

  • Picked up another, but similar book, to get started with iPhone / iTouch programming. Besides the horrible way that Apple wants to control how you deploy "your own software" on "your own device", what puts me off even more was the statement that you shouldn't expect that you can use the Touch used for testing your software, for normal operations anymore. As they noted it "the software environment will write to the Touch, which can make it unusable for normal use".

    Is this really true? Having to pay $99 is on

Programmers do it bit by bit.

Working...