Slashdot is powered by your submissions, so send in your scoop

 



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:
  • why?? (Score:1, Insightful)

    by Anonymous Coward on Monday January 19, 2009 @03:41PM (#26519127)

    why should i pay to develop for a device that is already overpriced?
    and in a language that no one else use?

    J2ME tools are free, and you wont get censured by AppStore...

  • The Machine Spirit (Score:1, Insightful)

    by Anonymous Coward on Monday January 19, 2009 @04:01PM (#26519379)
    The standard Hello World is the beginning of every rite to praising the machine spirit.

    ---------

    Oh good God this is getting posted Anon
  • iTouch (Score:5, Insightful)

    by linuxci ( 3530 ) on Monday January 19, 2009 @04: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.

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

    by shmlco ( 594907 ) on Monday January 19, 2009 @04: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 @04: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.
  • Re:iTouch? (Score:3, Insightful)

    by Facegarden ( 967477 ) on Monday January 19, 2009 @05:05PM (#26520211)

    Erm... I call it an iTouch. It's a good name (if it wasn't already in use I'm sure apple would have used it). I and my friends have no use for the services of the company called iTouch, so we aren't going to get confused for any reason. I know iTouch is technically incorrect, but contrary to the AC that posted before me in response to this, I'm not a "moron", i just like the name iTouch better, and everyone still knows what I'm talking about.
    -Taylor

  • First barrier (Score:2, Insightful)

    by Artifex33 ( 932236 ) on Monday January 19, 2009 @05:24PM (#26520483)
    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.
  • Re:First Step (Score:5, Insightful)

    by cabjf ( 710106 ) on Monday January 19, 2009 @05:30PM (#26520571)
    What an apt analogy. How many people buying cars buy them to change anything (or even care what kind of oil is put in them).

    I think the big disconnect between the average open source, linux geek and the general public is that the general public likes treating computers and computer based products as appliances that just work.

    The whole walled garden approach has worked out pretty well for Apple with the iPod and iPhone. If that doesn't fit your needs though, that's fine. Just don't assume that it isn't the best choice for anyone else because of your needs or opinions.

    The difference between what Apple is doing with the iPhone and what the cell companies are doing is that Apple is attempting to provide a user focused UI. Whereas the cell companies are trying to figure out how to charge for as much as possible for anything on their network.
  • by EvilIntelligence ( 1339913 ) on Monday January 19, 2009 @05:44PM (#26520799)
    Your rant runs out of steam very quickly:

    * Going out and buying an overpriced Mac that is useless for anything other than running the Apple devtools

    You can build a cheap Intel box out of spare parts and run a hacked copy of Mac OS X on it.

    * Having to waste time hooking up monitor and keyboard switches to your work environment just for the Mac hardware

    See my comment above.

    * Wasting time learning Objective C that no other company uses except Apple

    If someone's only goal is to write for Apple, and that's the world they live in, then that is a viable option to them. If its not for you, go about your life and leave them alone. They will live or die with their platform of choice.

    * Having your application be at the total whim of Apple who could at any moment or for any reason decide to reject your app or pull your app from the Apple store

    This comes down to a business decision. If you are a company (even if you're just an individual developer), you have to realize that the App Store is a distribution channel, and Apple is your distribution partner. You have to play well together. Bear in mind that they are not the only smart phone around, and the agreement is non-exclusive. There is nothing stopping you from offering your same app to other distribution channels.

    Android will have rapidly taken over most of the existing Windows Mobile range of devices just looking at the public release list of Android based phones for 2009. And Palm's Pre is now the gold standard for high end phones.

    This is pure speculation. If I was an investor, I would not dump my life savings into Android, or any single product platform.

    Apple got lucky with Microsoft completely botching their phone efforts and arriving at a time before Android and Palm's efforts.

    This issue is moot. Microsoft completely botches everything they do other than contract other companies to build video games for X-Box.

    The iPhone is nothing more than an irrelevant and overpriced niche product.

    I disagree completely. The "smart phone" movement was dead before the iPhone, because companies were complacent to put out products that people were willing to tolerate. Once iPhone came out, all the big players kicked their game into high gear. You think we would see the Palm Pre or the Blackberry Storm this year if it wasn't for iPhone? Like it or not, iPhone raised the standard for what a smart phone should be, and now everybody is going to look like they are chasing them.

    Even more so now that Jobs is out of the picture and Apple can no longer leverage the Cult of Jobs in the media for massive hype, promotion, and marketing for their products.

    There is some truth to that. But now this will be the test for Apple. Can they sell products based on their own merits? Or do they need that messiah? Time will tell.

  • by pfoorion ( 215620 ) on Monday January 19, 2009 @06:42PM (#26521523)
    Not crashing when calling something on a NULL object is not necessarily a bad thing. You should read: Enhancing Server Availability and Security Through Failure-Oblivious Computing [mit.edu] You can also use TRUE/FALSE and 1/0 for boolean values, too. Dropping stack allocation for objects is, IMHO, a good thing. The fact that C++ has to truncate an object when you pass a subclass to a method that expects the superclass via the stack, but does not when you pass a pointer to it. Not what most people would expect and would break dynamic dispatch.
  • Re:First Step (Score:3, Insightful)

    by NilObject ( 522433 ) on Monday January 19, 2009 @08:02PM (#26522631)

    10% chance?

    Since when were computers randomly distributed among people?

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

    by lordSaurontheGreat ( 898628 ) on Tuesday January 20, 2009 @03:11AM (#26525889) Homepage

    It was a five-year exclusivity contract in order to get the phone out the door. Carriers are notorious for refusing to put phones on their network unless there's something in it for them. Remember the Razr craze a few years ago? It's was exclusive to Cingular for the first year and a half or so. Then they started unlocking them, and now you can get them on Verizon and AT&T, etc.

    It's because the cellphone service market is a sad oligopolis. Your carrier doesn't give a damn about the quality of their service as long as they can spam the television with propaganda commercials claiming they're better than the other guy. AT&T has better coverage in Europe, from what I hear.

    Requiring money for an SDK isn't really that big a crime. Microsoft requires a large sum of money for their best SDKs and IDEs. Nintendo demands about $300 or so for an SDK license.

    Requiring a sum of money to gain access to the app store isn't that bad, either. Requiring a cut of the money isn't terribly horrible. What, would you honestly rather buy and maintain your own servers to host that content? What if someone Slashdots your app? What if it gets put in the top ten list? How will you connect your billing to a bank? Do you really want to pay $100 a month for an SSL certificate, or do you want to ignore that and let people transmit their credentials without the advantage of SSL? For only 30% it's a real bargain.

  • by jeremyp ( 130771 ) on Tuesday January 20, 2009 @07:39AM (#26527143) Homepage Journal

    What could possibly be a better use of a engineer's efforts than: * Going out and buying an overpriced Mac that is useless for anything other than running the Apple devtools

    Actually, you can do all sorts of things with a Mac - it's a general purpose computer.

    * Wasting time learning Objective C that no other company uses except Apple

    It's not a waste of time if you can make some money out of the apps you write with it.

    * Having your application be at the total whim of Apple who could at any moment or for any reason decide to reject your app or pull your app from the Apple store

    According to Apple there are 15,000 apps in the Appstore at the moment. So it's obviously not that hard to get your application accepted, particularly when you look at the quality of some of them.

    The bottom line for a developer thinking about investing in the tools necessary to do iPhone development is whether they can make money out of it. From that perspective, as long as the iPhone (and iPod Touch) have significant market share, there will be people willing to put the investment in to develop apps for them. I don't see that market share disappearing any time soon. Out there in the real world people like shiny devices, they don't care about the technical merits of the underlying operating system. They don't care about the restrictions the Apple Appstore places on developers, they just download hundreds of apps because it is so easy to do.

  • by Moondevil ( 149648 ) on Tuesday January 20, 2009 @08:20AM (#26527331)

    Why should I say goodbye to modern computing?

    As an example, there are OS implemented in Modula-3 and Ada. They are quite fast, and the languages are not "like C", though they do the job and there aren't buffer overflows to worry about.

    Maybe getting rid of C is what we need to finally embrace modern computing?

"The four building blocks of the universe are fire, water, gravel and vinyl." -- Dave Barry

Working...