Common pitfalls of iPhone development
I haven’t written any posts lately. This is because I dug into iPhone application development and this really consumed most of my spare time. As you may remember, I’ve already mentioned that I would like to start dealing with mobile platforms as a target for my OpenGL related experiments and projects. After Android, this time I got my hands on a Mac mini and took a look at the currently most popular mobile gaming platform. Actually, these initial experiments wouldn’t take that long time if I would have to deal with just a new API and not with a brand new world with its own benefits and drawbacks.
I have a long experience in using Windows and Linux as a development platform with tons of different development environment and programming languages. Beside that, I’ve also done some Mac application development, at least if we can call a cross-platform application so that works on all of these three desktop operating systems. Taking in consideration these facts I thought that starting to develop under Mac OS X targeting the iPhone platform will be piece of cake as I just have to master one another programming language and API, namely Objective-C and Cocoa Touch. Well, it turned out that I was too optimistic and this is not that simple as it looks like (at least for me, who hardly ever used a Macintosh before).
The GUI of Mac OS X Leopard
The first thing I’ve found very unusual is the user interface of the operating system. Primarily, I’m talking about the following little differences:
- The menu of the windows is at the top of the desktop, not the top of the window.
- The system buttons on the window title bar are on the left side, not on the right side.
- Double-clicking the title bar doesn’t maximize the window, it minimizes it instead.
- The most used key combinations like Copy-Paste and stuff like that are also different.
Okay, I know that these are such things that everybody know who already seen the GUI of Mac OS X, but still, it’s quite annoying that Apple is going totally against the rest of the PC world. I agree that different operating systems can define their own direction regarding to the layout of the GUI, but I wonder how I didn’t notice such huge conceptual differences when I’ve first started to work on Linux after several years of Windows user experience?
Anyway, these are just small things and it’s just a matter of time to get used to the new interface. Also, I can say that the Mac OS X user experience is excellent. I don’t say that it is any better than that of Windows or some well-made Linux distributions but it is not worse either.
The Xcode IDE
Those who heard anything about iPhone development know that the only legal possibility to write applications for this mobile platform is to do it under Mac OS X using the Xcode development environment. I know that thousands of people will blame me for what I’m going to say but I sincerely think that Xcode is the worst development environment I’ve worked with lately.
First of all, it was completely alien for me even though I worked with dozens of development environments ranging from basic text editors to full-fledged development environments with every tool integrated within them. While the most used editor features like syntax highlighting and code completion work flawless, there are huge amount of features missing from it that are common in other IDEs like a source code outline window. But this is not the only thing I can complain about…
As I mentioned it before, I dealt with many different development environments, the most noticeable ones are CodeGear RAD Studio, Visual Studio and Eclipse. What is common in these (and a lot of other Windows and Linux IDEs) is that if you migrate from one to another you’ll most probably won’t notice too much except some minor differences in key bindings. I think actually this is the way how it should work as if I would be the head of a software development company I would invest in a development environment that can be easily learned no matter what my future employees used earlier. This reduces competence development cost and enables the programmers to work more effectively in a relatively short time-frame. Well, it seems that Apple disagrees with me as comparing the aforementioned IDEs and Xcode is like comparing an armchair with a stool.
In spite of all his faults, Xcode has also some clever solutions for some usual tasks that makes it popular even though Apple gone again against the rest of the world with this software so I don’t say that Xcode is completely useless, but what’s for sure is that it has a long way to go in order to be able to compete with the other development environments out there. I don’t even understand why didn’t they just made a simple Eclipse plugin for their purposes like all other players do?
While maybe I’ve already scared many of you from using Xcode, yet I haven’t talked about the “feature” that made me the most frustrated about my new development platform. As I already mentioned, there are big differences between the key bindings of usual PC platforms and Mac OS X. I haven’t really worried about them, because for the basic navigation it is not a huge burden to get used to it, but when it comes to code writing I’m more choosy…
It seems like in the Mac world the Home and End keys have totally different meaning, in particular they don’t control the position of the cursor in the current line instead they control it in the scope of the file. As I’m heavily using these keys during source code editing I figured out it would be a huge burden to get used to this little but important difference. Fortunately, Xcode has possibility to change the key bindings of the editor but I was already quite pessimistic about how much hassle I will have with the key binding so I thought one step further and started to google for a quasi normal key binding for Xcode. Soon, I’ve found a Visual Studio-like one here that you can download below:
Visual Studio Key Bindings for Xcode
In order to install it, you only need to unzip the file MSVC.pbxkeys, copy it to /Users/YourUserName/Library/Application Support/Xcode/Key Bindings/ (if the directory doesn’t exist, just create it), restart Xcode and select the configuration set in the key binding tab of Xcode’s preferences window.
The Apple Developer Program
While the new key configuration already solved most of my problems that prevented me to efficiently start working on my first iPhone application, soon I realized how much of hassle an iPhone developer has to deal with on a daily basis…
As soon as I mastered the very basics of developing for the iPhone OS, I registered myself for the Apple Developer Program. It costs you $99 per year but it most probably worths its price as beside the fact that they deal with the publishing and marketing of your application, according to other developers I know, they also give adequate support for the money. The registration itself was very straightforward. I just had to fill and fax an application form and next day my developer program was already active. What made me outrageous at the end is the amount of administrative work that is required from the iPhone developers in order to solve the most simple tasks.
If you just want to play with the iPhone Simulator, the basic configuration of Xcode and the iPhone SDK is adequate, but as soon as you would like to try out your application on a real device, things get more complicated. As an example, I wrote my first cube rotating OpenGL app and wanted to test it on the iPhone of my friend. First, I thought that this will need only three things: connect the iPhone to the Mac, select the real device as target in Xcode and then press the Build&Go button. Well, it turned out that it is much much more complicated.
First, you have to create a certificate on your Mac that you have to upload in the Apple Provisioning Portal and then download it from there, install on your Mac, then connect the iPhone to the Mac, open the Organizer in Xcode, copy the device identifier of the iPhone, go back to the Portal, add the device, then go back to Xcode and copy the reverse URI of your application and then add the application in the Portal, create a provisioning profile with the device-application pair on the Portal, download it and add to Xcode and now you can select the device as target and press the Build&Go. This would be even acceptable if you would have to do it only once, as a preparation for development, but this is not the case. You have to create an individual provisioning profile for each and every device-application pair that you want to test. This is simply too much, especially in the early phases of development as you may start with several different test projects.
iPhone SDK and Mac OS X Leopard
You may think that after these steps I’ve already had my box rotating app running on the iPhone. Well, if it is so, then you’re wrong. Things got just more annoying after this… After investing money into a Mac mini and paying $99 to Apple for entering the Developer Program I though that I can startup with my first real project but I was wrong as well.
I bought the Mac mini from the brother-in-law of one of my friends. As he already developed some iPhone applications on the Mac earlier, I’ve already had Xcode and iPhone SDK 3.0 installed on it. The problem I’ve encountered is that just the day before my friend, Imi brought his iPhone to my place in order to test the application he had to update the firmware of the phone to iPhone OS 3.1.3. You may wonder, but Xcode with iPhone SDK 3.0 doesn’t work with an iPhone device that has the version 3.1.3 of OS installed on it.
Well, I thought I will just download the latest version of the SDK from Apple’s website, but I faced some further surprises… Actually there is a free download of Xcode 3.2 and iPhone SDK 3.2 at the site what you can freely download. The problem with this is that it works only on Mac OS X Snow Leopard but not on Leopard.
At this point I was thinking about that I’ve already invested a huge amount of money and now I have to pay another $29 for the OS update just to run my box rotating app on a real device. Anyway, I’ve chosen to invest this remaining amount as I really want to develop some games for iPhone. Unfortunately, I figured it out soon that you can order the OS update only inside US and there is no any way to grab a downloadable version for your money (at least as far as I can tell because I was already too pissed off to spend more time on Apple’s site to look around for a solution).
Our next idea was to downgrade the operating system of the phone to match the SDK what we have but Imi informed me that the oldest OS what you can downgrade for is 3.1.2. This was the time when I gone mad. I really found it ridiculous that someone buys a developer machine that was earlier capable for the purpose and afterwards, due to some stupid decision at Apple, it is simply not capable for it anymore, unless you pay more money to them for the OS upgrade. Anyway, at this time I would have been already satisfied if I can pay that $29 for the upgrade just to run the app.
It was actually pure luck that I didn’t give it up and started to google for people who met the same problem lately. Fortunately, I’ve found a guy struggling with the same problem and he posted a download link for the SDK 3.1.3 that works also on Leopard. He really saved the day! If you are having the same problem just grab the SDK from the following address:
Download iPhone SDK 3.1.3 and Xcode 3.1.4
Conclusion
Without the intension to blame the guys at Apple or anybody else, I can say that becoming an iPhone developer involves much more trouble that I have ever thought it could. Anyway, now I managed to get to the point where I can actually start to be productive so I won’t give it up now…
I planned to talk also about implementation related issues and tips in this article that you are most probably more interested in, but it seems that this topic is left for a future article as I had so much things to share now that it simply didn’t fit into the time-box. Anyway, I will recap on the topic in the near future.
| Print article | This entry was posted by Daniel Rákos on May 10, 2010 at 7:04 pm, and is filed under General, Graphics, Programming, Telecommunication. Follow any responses to this post through RSS 2.0. You can leave a response or trackback from your own site. |


about 1 year ago
Don’t bother jumping through the hoops of an overly paranoid monopoly just so that you can get a few dollars back at the end of the extremely long tail. Android wants your love, Apple are a bunch of haters. Choosing which applications are allowed into the AppStore, accessing files only through iTunes (WTF?), no Flash, no real multitasking. It just isn’t worth it.
about 1 year ago
Thank you for the information, now I know I won’t even try to develop for the iPhone.
I had the feeling that the path could be long and hard, but you really put a name on all the problems we can encounter.
You saved me money and sanity
about 1 year ago
I second Chris’ opinion. Besides the fact that you can only sell your application through the AppStore and Apple can make an arbitrary decision about allowing it or not (“two years of development time? doesn’t matter, I don’t like it, it’s a no-go”), it’s really difficult to stand out among the huge number of applications found there.
Unless you come up with a revolutionary (really revolutionary, not in the Apple marketing sense but in the real sense) idea and implementation, or you have a serious development team to back you up, it’s unlikely you will gain any real money from your endeavour.
As case in point, I tried finding an ars technica article I read a few months back which described how a two-man indie team (if I’m not mistaken) was very surprised when their game, in which they invested a lot of work, sold four copies (if I recall correctly) before losing itself in the depths of the AppStore and it never being heard from ever since. They hoped that their game would take off after being shown for a few hours in the “news” section, but obviously that didn’t work.
Anyway, in my search I found another article that reinforces the idea that Apple are just a monopolistic money grubbing corporation and iPhone users are (generally) smug idiots. Have fun reading the article. My advice – develop something for a platform that makes sense.
http://kotaku.com/5497459/apple-bans-game-days-after-developer-publicly-trashes-app-store
about 1 year ago
Dude… slowly… step away from the Macintosh.
about 1 year ago
While I somewhat agree with you I don’t think iPhone development is a waste of time. AppStore itself makes iPhone development so attractive, at least that’s my opinion, as even though you have to share your revenues with Apple, you get some kind of marketing, a download server and whatever other benefits for your investment.
About Android, well actually things work almost the same way in that case, except you are not obligated to publish your application on the official Android Market but you can share it in any way, but still, I prefer the online market instead and the problem with Android is that they currently don’t have any agreement with our government to provide this service here.
Anyway, it’s in my plan to also develop for Android when the market will be available in my country as I think this will be the second big player in this part of the industry.
As a final thought I would say that my primary intension is to finally publish some real game and if it is only possible for me to do it for mobile platforms then I’m okay with that. I do this for the fun and because I would like to get familiar with more and more APIs and platforms. I can really just hope that I will be able to regain the money I’ve invested in this experiment.
about 1 year ago
Hey Dan,
you summarised it well. I’ve had exactly the same problems with Mac development, but in the end I gave up on it. Not worth the hassle.
about 1 year ago
Well, actually my intension wasn’t to scare people from starting development for iPhone. I just wanted to share my experiences and all the information that might help others who meet the same problems.
It is simply a summary about what you have to prepare yourself for before actually making your decision.
about 1 year ago
And you didn’t think that on some of those differences, Apple might have gotten it right while Microsoft didn’t ?
To give you an example, this issue you had with the menu bar being always on the top of the screen. that is called the mile high menu bar.
On Windows, in order for you to click on a menu item, you have to vertically position your mouse at the level of your menu bar, then position it horizontally on top of the menu item, so that is 2 dimensions to take into account.
On Macintosh computers, you just quickly move your mouse towards the top and bump to the ceiling, then move it horizontally to your menu item. That is only 1 dimension to take into account, making it quicker and easier.
Apple designs their products with the users in mind, Microsoft doesn’t. That is the difference.
about 1 year ago
You don’t get the point. The article is not about Mac OS X being inferior compared to Windows. At that part I wanted to point out that it is quite difficult to get used to the new interface after many years of Windows and Linux usage.
That is actually really true, at least as I see, that Apple products look, act and feel more comfortable but they are always explicitly proprietary solutions and their platforms are always closed ones and that also makes you to depend on their decisions. And that’s nothing different than Microsoft’s philosophy.
about 1 year ago
I would like to correct an inaccuracy in your article: it is most certainly not necessary to generate a separate provisioning certificate for each device-application pair.
Apple clearly describes on the provisioning page that you can set the application name to a wildcard, in which case the provisioning certificate will allow the installation of any app signed with the certificate on that device.
If you set it up that way, then you only need a single provisioning certificate per device – much more manageable.
about 1 year ago
Thanks a lot for the tip. I didn’t meet with this piece of information on the provisioning portal but it’s good to know. So I have to recall one of my complains.
Anyway, thanks for the help!
about 1 year ago
In your situation, you can grab latest os x from torrents without “feeling bad”…
about 1 year ago
That’s never a good idea, especially because you would like to use the Mac for development. I think it wouldn’t work from technical point of view either (e.g. maybe some validity check included in the dev tools).
about 1 year ago
actually, there are no such checks on os x (never has been) or xcode. student developer program used to include free os x, quite good. That was sent to the member once new os x was released. And in comparison to MS the developer tools are all free.
I understand the “getting used to”.. though for long time mac users it all makes sense with the different menus, keys etc. Also, on a mac the use of the mouse for direct manipulation has always been in focus
about 1 year ago
also, snow leopard would give the benefit of more opengl features (usually supporting newer specs with new os x releases) and of course opencl..
about 1 year ago
Are you sure? Every software company tries to protect their products. I think MacOSX gonna have its own solution for this.
I tend to disagree when promoting Apple just because they give away developer tools for free. MS also released a free version of its Visual Studio products.
About Snow Leopard, I know that it has some new features but nothing very useful from iPhone development point of view.
Finally about OpenGL, well, MacOSX is still stuck at OpenGL 2.1 even though all the major desktop operating systems (at least Windows and Linux) have OpenGL 4.1 support. Apple’s OpenGL support is far behind its competitors and in this regard I cannot really understand Apple’s strategy as OpenGL supposed to be a core feature of MacOSX.
about 1 year ago
“Are you sure? Every software company tries to protect their products. I think MacOSX gonna have its own solution for this.”
Actually, the previous poster was correct. Apple has never used any form of copy protection except for their high-end applications (i.e. Final Cut Pro). The operating system itself, the developer tools, iLife, iWork, etc. are all free of copy protection. It is one of the major reasons I prefer Apple products.
The iOS ecosystem is very different, but that is the nature of the embedded world, I am afraid.
about 1 year ago
Yes, I am sure. They know their os will, for most part, run on their own hardware so they don’t put energy into any copy protection system.. Also they only have one version of their SDK and it is free (it always has been). I don’t think they will change this when they have not yet (after 7 os x releases).
I would say being able to install the latest xcode and sdk’s is of value, SL would be needed for that ;o)
Also, xcode 4 (which is reportedly quite good) will not run on Leopard.
Also I promote them for their contributions to open source community, many projects gets great contributions from apple (for instance the llvm compiler technology).
I agree with the opengl part you mention.. they have been stuck there too for too long. . Hope they get up to at least 4.0 next summer with 10.7.
My feeling is they have been to busy with the ios releases.. and getting drivers for new chips ready.. not having enough time for a major opengl upgrade. This will soon change though, I think, as games are about to get much stronger foothold on the os x platform these days.
about 1 year ago
Actually you are right, for MacOSX there is much more a hardware lock as unless you put together a PC with the exact same hardware it is very unlikely it will work anywhere else.
However, I wonder why the minor upgrade of the OS costs anything at all? It is like MS would charge you for getting service packs. Okay, I know they’re not the same but really, it was just a minor upgrade!
Sorry guys, I don’t have any problem with Apple and I know that many of my problems came from the fact that I’m quite a newbie in OSX development, just some of them were very frustrating, like that of the OS update.
monoton: I would be also happy to see better OpenGL support on OSX. Actually I had serious plans for cross-platform graphics apps (I mean here Windows, Linux, MacOSX and BSD), but the lack of proper OpenGL support on MacOSX made me stay on Windows-only as MacOSX would have been my second platform of importance.
about 1 year ago
Apple does expose almost all of OpenGL 3.1 already by way of extensions, so it isn’t as if the functionality isn’t there.
Basically we are waiting for the OpenGL 3 context creation to arrive – not the most important part of GL 3+. As for OpenGL 4, Apple hasn’t shipped any hardware with DX11 GPUs yet, so no need for that either.
I guess I don’t really see this ‘lack’ that many developers are complaining about?
about 1 year ago
Then explain why the GLSL support is still 1.20? New GLSL version support is the *main* feature of OpenGL 3.x and 4.x as it improved a lot since the version 1.20.
I know that some of the GL features as well as some GLSL features are exposed with extensions, but far from a GL3.1 support and that is also out of date as we are now at GL3.3 for SM4.0 class hardware.
Check this forum discussing the latest OSX GL support: http://www.opengl.org/discussion_boards/ubbthreads.php?ubb=showflat&Number=263105#Post263105
GL 3.0 support – 65% (15/23)
GL 3.1 support – 12% (1/8)
GL 3.2 support – 11% (1/9)
GL 3.3 support – 0% (0/9)
Here is your ‘lack’.
about 1 year ago
Daniel: I would claim $29 is a symbolic price for a good os. With SL they improved the foundations and made many changes and additions to welcome the multi-core era with grace. A lot of optimizations under the hood. It’s like MS charging $29 for Win7 (and, Vista was very bad compared to Leopard)..
Now, for OpenGL they should invest more, if they wanna call os x ‘the most advanced os in the world’, as they do from time to time..
about 1 year ago
http://www.youtube.com/watch?v=n9UPhwmjJ-Y&feature=youtube_gdata_player
http://www.youtube.com/watch?v=SNiWQcr7Z6k&feature=youtube_gdata_player
Some fun clips with Bertrand Serlet, relevant for the topic at hand