Which is the most supported programming language for the iPhone?
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++
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?
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.
objective-c is the most supported - all the examples use it
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.
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.
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.
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.)
精彩评论