Thursday, 1 May 2014

My rant about iOS development and why it sucks.

Developing an app for iOS is a tragic experience. I have multiple languages and frameworks under my belt and despite all the expected pains of learning a new language, most of these have been as expected. C#, Java, C, C++, PHP and even things like Python have all been reasonably logical. The tools are fairly easy to use and what happens is expected.

Enter iOS. Or rather, enter Objective-C, XCode, iOS and Cocoa.

Let us start with the language. Objective C might be old but in my opinion it is not logical at all. It is supposed to be "C on steroids" but I find it more like C with hemorrhoids. C++ works fine and is pretty logical and even QT which is C++ with messaging/events was really nice and easy to understand and consistent but Objective-C anything but. Square brackets all over the place but sometimes you can use dot notation. Trying to create function prototypes is a nasty business because it is hard to know what all the names on the prototype mean, are they types? labels? parameter names? Trying to chain things together like you might do in C => myObj->something->somethingelse() doesn't seem to work most of the time, you have to put brackets in funny places. Just when you thought you were getting to grips with it, you find out that you can't have a method pass a local parameter into another method if the parameter has the same name as the parameter in the function you are calling - for some reason, this confuses the compiler.

What about XCode? A very poor excuse for an IDE. It harks back to the bad old days when project settings were just really long lists of technical mumbo jumbo that anyone new to the game would not understand. Can you leave it all on the defaults? Maybe but what about supporting all the various versions of iOS with 32 and 64 bits? I've had to change these settings even for the basic stuff I'm doing and it's not pretty. Navigation feels awkward and since I'm used to Visual Studio, this is a very poor product in comparison. Little icon buttons where the icons don't mean anything so you have to click on them all anyway to find out where stuff is. In Visual Studio, you have a Properties window will categories. The storyboard editor is another wonder to behold. The dragging around is fraught with all kinds of problems and even trying to move and resize items can do really weird stuff with sizes and offsets. The wiring up of outlets and delegates etc. is properly weird and involves a lot of legwork. There are also a whole host of things which can only be done in code apparently. Round corners on a button? Either in code or in a free-format list on the object, there is no property for it.

So iOS itself. Well, for some reason, they dropped standard buttons. What does that mean? If I just want a good old common-or-garden button with text and perhaps some nice animation when pressed with a background colour, I have to do this myself. The colour and text is easy enough but rounded corners require hacking and to make the background change colour when clicked? A whole world of pain. Why were these removed in iOS7? "because a button might be an image or text or something else". True but it might also just be a normal button! Apple's documentation is woeful. It is hard to navigate, most of it looks auto-generated, the examples are either non-existent, out of date or very simplistic. You can find an event like UIApplicationWillChangeStatusBarOrientation but no information on what the delegate function needs to look like. It assumes you already know that. In fact, their documentation is so poor that even if you search for one of their classes or methods, you usually find 5 StackOverflow questions in the Google results before any hit on

In fact, it could be said that there is a lot of help online for iOS questions but the reality is that many of the answers are either for earlier versions of iOS (and it can be hard to tell if this is the case when you are learning the framework) or they involve what seem like copious amounts of code for something simple (e.g. how can I detect a change in orientation) or the answer is not even correct, especially when related to what versions support what.

I have spent two days trying to do very basic things. 1) Handling device rotation (fine if you want everything to be auto and a royal pain if not) and 2) Pinch and zoom of an image (very easy if you use a scrollview according to Apple) but this neither scrolls, zooms and it displays the child image at completely the wrong size by default.

All-in-all, I feel very sorry for iOS developers. You basically have to learn to be really hacky, involved and low-level just to work out really basic ideas. I'm amazed at how good some of the iOS apps are but sadly, I have written an entire Android app in Java (another language I had to learn just for the Android project) in about the same time it has taken me to try and modify a few things on an iOS app that was written for us by someone else. The Android docs are far better, the way to do something is much clearer, all the things you would expect to do in a mobile app are exposed and easy to get hold of and Eclipse is a far friendlier environment than XCode.

I want to like it because it is not Java but I don't.
Post a Comment