开发者

A C# developers guide to Objective C? [closed]

开发者 https://www.devze.com 2023-01-09 09:59 出处:网络
As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references,or expertise, but this question will likely solicit debate, a
As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance. Closed 9 years ago.

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 fin开发者_开发技巧d a good guide tailored to my background to get me moving in Objective C?


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


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.


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.yetanotherchris.me/home/2009/6/22/objective-c-by-example-for-a-c-developer.html


Have a look at the:

Cocoa Literature List

C / Objective-C

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


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.


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)


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


Cocoa and Objective-C: Up and Running

by Scott Stevenson

http://cocoabook.com/


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

0

精彩评论

暂无评论...
验证码 换一张
取 消