views:

440

answers:

9

I'm primarily a C# developer and I've been tasked with "porting" functionality from a few apps to an iPhone app.

The functionality is simple enough, and a language is a language, so I thought, "sure, why not? This will be fun!" ...That is until I got a look at Objective C, which, to me, is ugly bordering on unreadable.

Given that my background is primarly C#, and I'm somewhat familiar with C++, where can I find a good guide tailored to my background to get me moving in Objective C?

+5  A: 

The one and only tome I recommend for learning Objective-C for people coming to ObjC from really many backgrounds, is Kochan.

jer
+1  A: 

A short trip through Google brought up the following:

http://www.thejohnsonblog.com/2010/02/19/iphone-objective-c-for-the-csharp-developer/

http://howtomakeiphoneapps.com/2009/07/making-the-move-c-to-objective-c-the-gotchas/

http://www.shrinkrays.net/code-snippets/csharp/objective-c-by-example-for-a-c-developer.aspx

Randolpho
I did actually consult the googs first, but my search skills must be lacking because I didn't see anything like that.
blesh
@blesh: no problems. Just throwin out some links I found interesting.
Randolpho
+4  A: 

I would really recommend that you check out MonoTouch:

http://monotouch.net/

It let's you develop for the iPhone using C#. You could probably re-use a bunch of your existing code and just concentrate on making a nice iPhone UI. You still need to develop on a Mac though so you will need that.

EDIT: The concern over using MonoTouch that has been raised here is no longer an issue as Apple has changed their policy (for the better!)

http://www.apple.com/pr/library/2010/09/09statement.html

I have removed my warning that MonoTouch may violate Apple's terms of service. To my knowledge, no MonoTouch developer has ever had their app rejected by Apple and now it is officially no longer a concern.

Justin
Why the downvote, can I get an explanation?
Justin
You need to develop iPhone applications in C, C++, Objective-C or Objective-C++ (native apps) or JavaScript (only run ontop of the WebKit). This is clearly laid out in section 3.3.1 of the developer agreement. You don't have to like it, but that's how it is. And it's not the iOS 4.0 license terms, they took effect before 4.0 was released, and apply to anything submitted to the store after that time.
jer
+1 -- @jer It apparently isn't clear to the Monotouch team -- see their site for more info. Several MonoTouch apps have been approved since the latest release so I don't think it's a show-stopper.
Andrew Flanagan
@jer, Thank you for the explanation. I do allude to that in my answer. Somebody should tell Apple though because they keep approving apps written this way and even featuring them. There is some speculation that this language was really put there just to ensure that Adobe could not sneak Flash apps onto the iPhone.
Justin
This is interesting, and may be fun to play with, but isn't really what I'm looking for. One of my requirements is that it be in Objective C.
blesh
Just because apple is approving apps that violate their agreement doesn't mean squat. They have rejected a lot more too, so would you rather spend a lot of time working on a codebase that could be rejected outright, or when you go to update it rejected, perhaps even pulled at a random time for violating it when they start the crackdown? I know I wouldn't.
jer
@jer and others reading this now - The language in section 3.3.1 has been changed. Writing apps in C# is no longer a concern.
Justin
+1  A: 

Have a look at the:

Cocoa Literature List

C / Objective-C

http://osx.hyperjeff.net/Reference/CocoaArticles?cat=23

trevor
+1  A: 

As others have suggested, MonoTouch may be the best option for you. Apple's section 3.3.1 notwithstanding, no MonoTouch apps have yet been rejected from the App Store, and you can always distribute MonoTouch apps through Enterprise distribution if that is your situation. If you don't want to step out of your comfort zone, stick with C#/.Net. That way you only have to learn a new UI framework.

That said, many good developers find that learning a new language is an opportunity to expand their thinking, beyond just being fun. Objective-C has a very interesting history and is (at least) part of the the inspiration for many "modern" languages. Objective-C's stated purpose was to make integrating software components easier, hence its interesting mix of static typing and dynamic message dispatch. Your comments suggest you've taken a rather harsh view of the language. Many of us have the same reaction to any new environment, language, etc. Give it time and you may find that the special features of Objective-C outweigh the "ugliness" you see now.

In terms of learning Objective-C, Aaron Hillegass' book is pretty much the bible. It's OS X-oriented, but you should be able to take the appropriate iOS bits from it. Also, Apple's Objective-C Programming Language guide is very good.

Barry Wark
I learnt Objective-C with Aaron Hillegass's book. He has actually got an iPhone programming book out too. If it's as good as the Mac OSX book, it'll be a good starting point.
JeremyP
Despite my answer above, I actually really like Objective-C. I have a soft spot in my heart for the NeXTStep days and always wished GNUStep had made a bigger splash.
Justin
A: 

Cocoa and Objective-C: Up and Running

by Scott Stevenson

http://cocoabook.com/

ceeit
Gotta love O'Rielly books for random pictures on the cover, lol. Thanks I'll check it out.
blesh
+1  A: 

To get yourself moving in Objective C take Kochan's introduction to Objective-C, get familiar with the basic concepts of the language - classes, objects and methods in particular - and then try to create a SnowLeopard-compatible command line tool to set the system sound value by understanding the Objective-C design of the following SoundVolume code:

http://www.cocoadev.com/index.pl?SoundVolume (code by Ryan)

chad
A: 

A nice introductory article that provides some good background information as well is ...

"Objective-C's niche: why it survives in a world of alternatives",

http://cocoawithlove.com/2009/10/objective-c-niche-why-it-survives-in.html

Karlo
+1  A: 

As a C# developer you should find the Cocoa & Objective-C articles by Kevin Hoffman quite interesting (esp. on his dotnetaddict blog). One of his projects is the (planned) book "Cocoa and .NET Programming".

http://kevinhoffman.sys-con.com

fendo