2

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?

6 Answers 6

9

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.

3
  • Wow sounds confusing :-) But I will give it a go May 24, 2010 at 13:20
  • 1
    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
    May 24, 2010 at 13:45
  • @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 May 24, 2010 at 15:03
3

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

2
  • Not just most, but the only supported language, if "supported" means "officially supported by Apple". May 24, 2010 at 12:29
  • 3
    That's not true. C and C++ are both officially supported. There are no C++ APIs for iPhone, but there are C APIs. May 24, 2010 at 12:40
2

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.

2

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.

0

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.

0

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.)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.