Beginning iPhone Development
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.
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.
What the hell is an iTouch? Sounds like something from a sex store.
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.
Reply to That ||
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...
Saying "iTouch", you fucking toolbox. It's an "iPod Touch". How difficult is that?
Programming the device is rather simple, going through all the Apple hoops just to put the app on your device or deploy it is far
more difficult. In fact if you start the developer sign up process and your application programming on the same day it is highly likely
that your app will be ready way before Apple gives you the go ahead to pay them $100 for the opportunity to program for it.
> 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 the code-signing.
"Between strong and weak, between rich and poor [...], it is freedom which oppresses and the law which sets free"
There is nothing sacred about a simple 'Hello World' application.
I was told by my first C instructor that if we didn't do a Hello, World! application first, we would be thrown to the lowest depths of programming hell. I had no interest in taking such a risk at the time.
Reply to That ||
The standard Hello World is the beginning of every rite to praising the machine spirit.
---------
Oh good God this is getting posted Anon
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.
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.
-- these are only opinions and they might not be mine.
Not doing "Hello World" is no where near as dangerous as using GOTO!
I only look human.
My mother is a halfling and my dad is an ogre, so that makes me an Ogreling
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. Honestly, though, it's probably easier to just jailbreak your iPhone.
Bogtha Bogtha Bogtha
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
1. The language discussed is Objective C, not C.
2. If no one programs in languages like C, you can say goodbye to modern computing. There's no way you're going to program an operating system in Python.
iTouch 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.
If you have to pay a corporation a single dollar for the permission to program, you are doing it wrong. How does Apple get a free pass for this kind of shit?
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.
You don't have to pay a single cent to program. You have to register... But the SDK is completely free. Anyone can download it.
What you do have to pay for is distributing your software to live hardware. Apple uses code signing much like you see on consoles like the Xbox and PlayStation. If you aren't worried about distributing to other people you can always just jailbreak your device... Then you don't even have to pay for the code signing.
"Work is the curse of the drinking classes." -Oscar Wilde
There is a company in Reston VA that trains iPhone developers http://www.aboutobjects.com/iPhone-SDK-Course.do
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).
You can do limited ad-hoc distribution, you can distribute the source code or you can choose to pay them $99 to use the app store. Not ideal but a lot better than how a lot of people think it is.
/Mikael
Greylisting is to SMTP as NAT is to IPv4
Dear Sir, Madam, or Troll;
If you don't care, then you're not our customer anyway. As such...
We don't care.
Sincerely,
Apple Legal
Any sect, cult, or religion will legislate its creed into law if it acquires the political power to do so.
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
Slashdot's rate-of-post filter: Preventing you from posting too many great ideas at once.
"You can do limited ad-hoc distribution"
It is my understanding that you are wrong. Can you provide any sort of citation?
Unfortunately Objective-C is designed such that it combines the worst parts of C with the worst parts of dynamic languages, so your point doesn't really hold. Method dispatch is all dynamic, and in the best case seems to be twice as slow as a C++ vcall. But it only gets that speed by building runtime dispatch caches, ie, trading off memory against CPU. On phones memory is also very limited.
It really is an amazingly stupid language. I am not surprised no-one except Apple uses it. This is the language that thinks it's a good idea to redefine boolean to be YES and NO.
That sort of weird syntax quirk is not a big deal though, it's just a time-waster. The real problems start when you realize that calling a method on a NULL object doesn't crash. Instead it returns zero, another NULL or if the method returns a struct, garbage. So what would be a clean kill with a nice stack trace in any sane language in Objective-C turns into silent propagation through your code of NULL pointers and zeros, until you save state and blow away the users data.
On the iPhone there's no garbage collection. Yes it's back to the days of ref counting, whoopie-doo. The best they have to offer is a kludge called an "auto release pool", which basically just scopes lifetime to the current GUI event. Pretty useless for anything that lasts longer than a button push. It also massively complicates exception handling due to the rules around how auto-release pools stack (yes really).
Then there's the lack of features. No namespaces. No abstract classes. No stack allocation thus no RAII. No operator overloading. No generics, really no type safety at all (calling a non-existant method is a warning not an error). Your code is trivial to decompile. And of course the only really supported development environment is a Mac.
Java might be a stupid language to use on a phone as well, but seriously, I'll take that kind of stupid any day over Objective-C.
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
Worldwide Military budgets: $2100 billion. Worldwide Space Exploration budgets: $38 billion. Really, world? Really?
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 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 development. I considered going the jailbreak route, but ended up not doing so.
...laura
PalmOS vs. Blackberry. No comparison needed. You wouldn't know one was running Java if it hit you on the hit with a giant strychnine laced bean. :-)
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.
Try using Google, "iphone ad-hoc distribution" should give you all the info you need.
/Mikael
Greylisting is to SMTP as NAT is to IPv4
Mamoo dogface to teh banana patch.
If you mod me down, I shall become more powerful than you could possibly imagine.
still waiting for the windows SDK.
How do you make a small fortune as an iPhone developer?
Start with a large one.
If you mod me down, I shall become more powerful than you could possibly imagine.
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...
This space for rent, inquire within.
Say it as often as you want but some people will try.
- Michael T. Babcock (Yes, I blog)
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.
My own pointless vanity vintage computing page
* 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.
Oh noes! Something costs $99... the horror! You may want to look up something called "capitalism".
... and then they built the supercollider.
Are you just trolling? I mean, I was genuinely interested when I asked for a citation at first, but I googled that and read the top few hits, so now I'm annoyed at you for wasting my time. According to those top few hits, you are definitely wrong.
"ad-hoc distribution" apparently lets one beta test on up to 100 (pre-identified) iPhones, instead of just one. As widely understood (by everyone but you) you still can't put code on your own iPhone without paying $99, nor can you give someone code without involving Apple.
- if you have a programming background, read up on objective-c
from the docs on apple site
Then jump into this book. It was certainly helpful for me
to understand how interface builder and objective-c interactive.
The book helps understand that very well.
Also some of the example for navigation bar, tab bars, animation were helpful also. To get more familiar after reading this book,
go to the class library reference or the reference docs from apple.
How have none of the fanboys mentioned yet that you can develop iPhone apps on Linux with Mono?
Mono now supports static compilation, which is one of the requirements to create a legitimate app that can be sold via iTunes. Search for "iphone" on Miguel de Icaza's blog (via Google) to see a number of posts on the subject.
You still have to pay all of the fees, but you aren't limited to Objective C and, in theory, you never have to sully your hands by touching a Mac keyboard.
(Preemptively -- also remember that Mono supports more than just C# and VB.NET. Again it's just theory, but you could write an iPhone app in IronPython, Boo, PHP, Pascal, etc. Anything that compiles down to CIL.)
From Wikipedia (http://en.wikipedia.org/wiki/Objective-C)
"Objective-C, like Smalltalk, can use dynamic typing: an object can be sent a message that is not specified in its interface. This can allow for increased flexibility â" in Objective-C an object can "capture" this message, and depending on the object, can send the message off again to a different object (who can respond to the message correctly and appropriately, or likewise send the message on again). This behavior is known as message forwarding or delegation (see below). Alternatively, an error handler can be used instead, in case the message cannot be forwarded. If the object does not forward the message, handle the error, or respond to it, a runtime error occurs."
So it would appear that calling a method (i.e. sending a message) on an object that does not have a method should blow up during runtime ?
As the island of our knowledge grows, so does the shore of our ignorance.
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 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.
"limited" was the important part, it's easy to be too optimistic somtimes, doesn't make it trolling. :-)
Perhaps you wanted some way to distribute/sell outside the controll of Apple?
Personally I find Objective C really rather neat. Of course it undoubtably helps that I grew up with C and can hack it upside down and backwards. I never really used C++ to anything like the same degree (having moved on to other things) and so when I started playing around with the iPhone recently this was my first taste of Objective C.
It's syntax really is weird I agree, but once you get past that - and it's no worse than many other languages - it's just hunky dory. Certainly the freedom of not having C++'s bondage style language features and ridiculous complexity really is rather refreshing. And no gabage-collection - well if you're just coding something the size of an iPhone app and you can't handle your own garbage then really you should go stick to visual basic in a nice safe environment.
The SDK requires an Intel Mac.
It does, but I think the OP point was that "nil" effectively implements all methods and returns 0, nil, or 0XDEADBEEF1374, like a bottom class without the semantic consistency of languages with true bottom types.
Don't blame me, I voted for Baltar.
There are many resources available for iPhone/Cocoa programmers. The earliest versions of Cocoa shipped commercially in 1988, and the most used features and patterns haven't changed much. Here is a good place to start: http://www.cocoadev.com/index.pl?CocoaPrerequisites
Why does Objective-C use BOOl and YES,NO instead of bool and true/false? One reason is that Objective-C predates the addition of the bool type to standard C by 11 years.
If you don't like dynamic languages, you won't like Objective-C. Bruce Eckel makes an interesting argument for dynamic languages at http://www.mindview.net/WebLog/log-0025.
I think the ability to seamlessly use and intermix the world of C and C++ software with Objective-C outweighs and criticism that Objective-C includes C.
You must keep an open mind - There are an infinite number of different ways to solve every programming problem. Many programming languages and reusable software libraries use different approaches to solve common problems. There is a good chance that Objective-C and Cocoa use a substantially different approach from other languages and frameworks you may have used. That doesn't make either approach better or worse automatically. Every commercial software development technology has advantages in at least some cases or the technology would not exist. Cocoa is renowned for enabling very high programmer productivity without constraining the set of problems that can be solved, but programmer's opinions will always vary and software development environments are subject to aesthetic judgments irrespective of abstract technical merit. Many programmers are enthralled by Objective-C and Cocoa. You might be enthralled too. Or, you may never like Objective-C and Cocoa from an aesthetic standpoint, and there isn't really anything anyone can do to change that without affecting the aesthetics for others.
The original poster (ghandi_2) bemoaned the inability to put code on his own device without paying Apple more money. mikael_j claimed this was actually possible - specifically describing ad hoc distribution as an alternative to paying the $99. That surprised me, so I asked for a reference. His response: "Try using Google". I did. He's wrong. Saying that without having done it yourself: Troll.
and most applications run only 1.1 times faster than a modern Java app anyway.
An instant ten percent speed up just by choosing the right language can be a meaningful speed increase in many applications.
Get the frame buffer, draw a few bitmaps in, and put in a few bodily noises. You'll be rich in no time.
Why should you have to pay 99 dollars to run an app that you wrote on your own phone?
Sounds like you really didn't use Objective-C/Cocoa long enough to even remotely start to grok it.
- Runtime dispatch caches: what, you think all those vtables that C++ generates don't take up memory?
- Definition of boolean: Objective-C & Cocoa were around long before C added a proper bool type, so yes, they used typedef char, just like every other C framework in existence.
- Messaging null: different, but neither a wholelot worse nor better. If you care about propagation of return values, you'd best be checking. But just as C++ lets you delete null for a convenience, Objective-C lets you message nil for the same reason.
- Autorelease: apparently you didn't notice, what autorelease does for you is that, outside of property accessors, you rarely actually have to bother with reference counting. (And if you'd worked with this for long, you'd have realized that the need to stack autorelease pools is quite rare.)
- I'd like namespaces and abstract classes.
- If you want RAII, just do it yourself using Objective-C++ and constructors/destructors that call retain/release. (Although if you work with this long enough, you'll eventually realize that approach adds overhead for almost no benefit.)
- If you want generics, go ahead and use STL, I do it all the time ;-)
- Non-existent methods: come on, are you really admitting in such a public venue that you ignore compiler warnings? Sloppy!
Yes, Gary, you can go to the bathroom.
Shop as usual. And avoid panic buying.
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 one thing, but having to buy another Touch, just for the fun of developing apps for it, seems to be a little too much.
I'm a pretty experienced WM5 developer, and I can use my regular phone to test my software. Nothing that gets blown away by the SDK.
Browsers shouldn't have a back button!! It's all about going forward...
Is that a promise?
We don't believe in radical loony monotheistic religions from the middle east -- we're Christians.
You don't need to pay $99 to run your own app. You only need to pay to run the app on non-pre-identified phones.
I personally think you should be able to run any app for free on any phone without paying Apple anything. But let's not pretend that people developing for personal use must pay $99.
/ Or pretend that development for equivalent platforms -- like Windows Mobile -- doesn't require you to purchase $600+ in software from the platform vendor.
C++ only does that if you are trying to pass classes by value, which is almost always a bad idea. I agree it's unintuitive but then a lot of C++ is, you don't lose anything if you simply never pass subclasses by value. If you use references the whole problem disappears.
Actually, you can do all sorts of things with a Mac - it's a general purpose computer.
It's not a waste of time if you can make some money out of the apps you write with it.
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.
All I want is a secure system where it's easy to do anything I want. Is that too much to ask ~~ Randall Munroe
Let me tell you a secret.
There were other systems languages before C and there *will* be others after C.
Although C is a nice language, it is also the major culprit of today's lack of security in major OS.
I dream the day when the OSs are coded in a systems language not prone to buffer overflows and memory leaks.
There are many examples of such OSs, unfortunately they didn't get any major impact on our daily lives.
Maybe singularity will change that.
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?
Ah, another pontificating buffoon who has never used or seen smalltalk.
Hot flash from the newsroom, genius - ObjectiveC is an extension of C. If you want to use the features of C or call regular C code, you can. Indeed, for some features, such as CALayers, that is the only way to do it.
Now, if you are more comfortable with C++, keep programming in it. Skip the iPhone development a stick to Windows.
Freaking language snobs. Right tool for the job. I use C, Java, ObjectiveC and even a bit of various scripting languages daily. Get over yourself, honestly.
Never by hatred has hatred been appeased, only by kindness - the Buddha
You can? Care to give a link to some instructions from someone that's done it? See, I tried to do this about 6 months back. Managed to get OSX installed in a partition on my PC multibooting with XP & ubuntu, but as soon as I installed the iPhone dev kit the mouse stopped working. I can boot it and use the keyboard, but I can't seem to find any evidence that the dev kit was installed, although I've never used OSX before this so I'm not very familiar with the key shortcuts.
The SDK *says* it requires an Intel Mac, but my wife found instructions on the net and just last night we compiled and ran from XCode on her G4 to her iPhone.
She had been excited that we had an excuse to upgrade from her G4, but it turns out iPhone development doesn't require us to upgrade.
Have a look at the InsanelyMac forums, all the info is there. Unfortunately the signal to noise ratio is quite low, but you can generally find what you're looking for. I have to say though, if you're not willing to invest a good chunk of time setting up your Hackintosh, don't bother. If you thought running Linux was hard, you ain't seen nothing yet ;)
Another hint (assuming you really want to do it), consider dedicating a whole drive to OSX instead of a single partition; you avoid many problems and it's safer too.
gcc: no input sig
Thanks for the reply Fulg, as I said I did get OSX up and running. It just broke when I tried to install the dev tools. Having invested a lot of time already, I gave up and I'll not be attempting it again unless there's a step by step guide including the dev tools. I did try using a dedicated drive but the biggest spare I had was 8Gb which wasn't enough.
Sounds like you gave up too easily.
Why should you have to pay 99 dollars to run an app that you wrote on your own phone?
Because if that is what the license requires, then you pay it, or don't buy it. Why do you think you are automatically entitled to the free use of software that anybody writes? It's Apple's property, you don't have to use it.
In any case, as noted elsewhere, you don't need to pay to write your own app, you pay to distribute it to others.
... and then they built the supercollider.
Actually you do have to Pay the $99 to run it on your own pre-identified phone. You can't register a phone as a "developer" phone until you pay the "developer" fee. I paid the fee, so obviously I consider it worthwhile, but on the flip side i can see where people don't care for the arrangement. I can totally see the $99 to distribute on the app store, but it does seem like you should be able to register your phone without a fee. As you point out, it's certainly no worse than the cost of entry for WinMo development, and obviously I didn't consider it THAT big of a deal or I'd not have paid, but I can see where people don't like it.
I don't need a million points of light, just two points of multi-mode fiber and a 10 Gig-E router.
Well maybe I did, but I was working overtime at work, decorating the house most weekends & evenings and have a wife and three kids to attend to - so my lame excuse is time... I just couldn't justify any more time on it. I think I spent 30+ hours or thereabouts. So, got a step by step link? ;-)
Excuses. Nothing more than excuses. If you really, really wanted to get it working, you would find a way. How important is it to you? The link you are looking for is on Google. Search for it.
I was just looking for an easy step by step link because it's not important enough to me to prioritise over all the other stuff I have to do. At least I know it is possible, and maybe I'll find the time someday.
Cheers.
This is the language that thinks it's a good idea to redefine boolean to be YES and NO.
You do realize that Objective-C was designed before C had a boolean type, right? (C didn't have a standardized boolean type until C99, but Objective-C has been around since the mid-80s.) So they weren't redefining anything. Everyone else at that time was just using a char or int and had a "#define TRUE 1" at the top of their programs...
-- Tim Buchheim