tags:

views:

198

answers:

7

Hi.

I have decided to start programming some apps for the iPhone that eventually will get submitted to App Store. So I have to use a language the Apple supports.

However, from what I understand, there are some variety of languages I can choose from.

Ansi C

Objective C

C

C++

I started learning C++ in school back in 2001, so maybe I should use that. However, I would like to use the language that is most supported API and community wize. Which one is that?

+3  A: 

objective-c is the most supported - all the examples use it

Andiih
Not just most, but the *only* supported language, if "supported" means "officially supported by Apple".
T.J. Crowder
That's not true. C and C++ are both officially supported. There are no C++ APIs for iPhone, but there are C APIs.
Phil Nash
+2  A: 

Main language for iPhone platform is objective-c - almost all frameworks are objective-c based so you will have to use it for UI part at least. However as objective-c is a superset of c language you will be able to write some parts of your program using c/c++ as well.

Vladimir
A: 

Objective-C is a superset of C/C++. You must learn C/C++ to code with Obj-C but you can't develop for iPhone only with C/C++. Many issues must be codified with Obj-C, although you can codify many things with C/C++. For example the line in Obj-C

[anObject aProperty]

is equal to this in C++

anObject.aProperty

But you can't use C/C++ for some issues like synthezising properties, link outlets and actions, etc.

In game development it's recommended to avoid Obj-C when you can use the similar in C/C++ but Obj-C is very powerful and cleaner than C++.

Espuz
Objective-C **is not** a super set of C++. And `[anObject aProperty]` is closer to `anObject.aProperty()` in C++.
KennyTM
Who upvotes this?
Nikolai Ruhe
Yes, is a superset of C, not C++. Sorry about that. About the property, I'm using the syntax on Xcode, where the two sentences returns the same result.
Espuz
I upvoted. I am the OP, so I didn't know better..
Shervin
+2  A: 

There are C and Objective-C frameworks. Quartz2D is written in C but the Cocoa Touch framework is written in Objective-C, for instance. As Objective-C is a superset of C, if you choose Objective-C you will be able to use all available frameworks without problems.

asandroq
+8  A: 

Here's the low-down:

All iPhone SDK APIs are either Objective-C or pure (ANSI) C. The pure C APIs tend to be the lower-level APIs, so you could use just Objective-C. However Objective-C is a strict superset of C, so you'll need a reasonable grounding in C in order to write Objective-C.

C++ is fully supported, but is not required (there are no C++ APIs). You can even mix Objective-C and C++ in the same source using Objective-C++. If you do this it's best to use C++ for pure computational components, pure Objective-C for the front-end, and Objective-C++ for the "glue" layer in the middle.

In summary: you'll need C and Objective-C. Use C++ for some parts if you particularly need it.

Phil Nash
Wow sounds confusing :-)But I will give it a go
Shervin
You don't really need to know C to code in Objective-C, but you should definetely have worked with another coding language prior to learning Obj-C. If you have no experience what so ever in coding, you should probably learn some C first.
Emil
@Emil. You don't need to know C inside out - but you need at least a basic proficiency with it - since you'll be using many C language features within Obj-C - and it's very hard to get away from the C APIs - think of things like `CRect`, for example
Phil Nash
A: 

Depending on what type of applications you're gonna to write, you could save yourself a lot of time & headache and use Appcelerator's Titanium Mobile (JavaScript) or Rhomobile (Ruby). All according to Apples latest TOU and therefore still submittable to the App Store.

kishkash
A: 

The only languages that are officially allowed by Apple are

  • JavaScript
  • Objective-C
  • C++
  • C

All other languages are not allowed.

Whether or not this restriction is legal is a totally different question. (My gut feeling says that, at least in countries with somewhat sane anti-trust laws, it's illegal.)

Jörg W Mittag